[vlc-commits] Remove now useless vlc_exit_t.killed

Rémi Denis-Courmont git at videolan.org
Mon May 7 18:58:20 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon May  7 19:48:57 2012 +0300| [72d46b6bf278f621294d4e1558c69e9e321c399c] | committer: Rémi Denis-Courmont

Remove now useless vlc_exit_t.killed

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=72d46b6bf278f621294d4e1558c69e9e321c399c
---

 src/libvlc.h    |    1 -
 src/misc/exit.c |   15 +++++----------
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/libvlc.h b/src/libvlc.h
index 4eec20b..f8a3f4e 100644
--- a/src/libvlc.h
+++ b/src/libvlc.h
@@ -76,7 +76,6 @@ typedef struct vlc_exit
     vlc_mutex_t lock;
     void (*handler) (void *);
     void *opaque;
-    bool killed;
 } vlc_exit_t;
 
 void vlc_ExitInit( vlc_exit_t * );
diff --git a/src/misc/exit.c b/src/misc/exit.c
index 9667bd4..27985a4 100644
--- a/src/misc/exit.c
+++ b/src/misc/exit.c
@@ -32,7 +32,6 @@ void vlc_ExitInit( vlc_exit_t *exit )
     vlc_mutex_init( &exit->lock );
     exit->handler = NULL;
     exit->opaque = NULL;
-    exit->killed = false;
 }
 
 void vlc_ExitDestroy( vlc_exit_t *exit )
@@ -50,8 +49,6 @@ void libvlc_SetExitHandler( libvlc_int_t *p_libvlc, void (*handler) (void *),
     vlc_exit_t *exit = &libvlc_priv( p_libvlc )->exit;
 
     vlc_mutex_lock( &exit->lock );
-    if( exit->killed && handler != NULL ) /* already exited (race condition) */
-        handler( opaque );
     exit->handler = handler;
     exit->opaque = opaque;
     vlc_mutex_unlock( &exit->lock );
@@ -65,13 +62,11 @@ void libvlc_Quit( libvlc_int_t *p_libvlc )
 {
     vlc_exit_t *exit = &libvlc_priv( p_libvlc )->exit;
 
+    msg_Dbg( p_libvlc, "exiting" );
     vlc_mutex_lock( &exit->lock );
-    if( !exit->killed )
-    {
-        msg_Dbg( p_libvlc, "exiting" );
-        exit->killed = true;
-        if( exit->handler != NULL )
-            exit->handler( exit->opaque );
-    }
+    if( exit->handler != NULL )
+        exit->handler( exit->opaque );
+    else
+        msg_Dbg( p_libvlc, "no exit handler" );
     vlc_mutex_unlock( &exit->lock );
 }



More information about the vlc-commits mailing list