[vlc-commits] playlist: use proper boolean instead of vlc_object_(kill|alive)

Rémi Denis-Courmont git at videolan.org
Wed May 9 18:53:08 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed May  9 18:44:58 2012 +0300| [89e293c6a83dbfe62060f81f9a60a2a8937d2245] | committer: Rémi Denis-Courmont

playlist: use proper boolean instead of vlc_object_(kill|alive)

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

 src/playlist/control.c           |    2 +-
 src/playlist/engine.c            |    1 +
 src/playlist/playlist_internal.h |    1 +
 src/playlist/thread.c            |   10 +++++-----
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/playlist/control.c b/src/playlist/control.c
index bf46a32..c01643b 100644
--- a/src/playlist/control.c
+++ b/src/playlist/control.c
@@ -107,7 +107,7 @@ static int PlaylistVAControl( playlist_t * p_playlist, int i_query, va_list args
 
     PL_ASSERT_LOCKED;
 
-    if( !vlc_object_alive( p_playlist ) )
+    if( pl_priv(p_playlist)->killed )
         return VLC_EGENERIC;
 
     if( playlist_IsEmpty( p_playlist ) && i_query != PLAYLIST_STOP )
diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index 01d887a..e22a1b2 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -169,6 +169,7 @@ playlist_t * playlist_Create( vlc_object_t *p_parent )
     VariablesInit( p_playlist );
     vlc_mutex_init( &p->lock );
     vlc_cond_init( &p->signal );
+    p->killed = false;
 
     /* Initialise data structures */
     pl_priv(p_playlist)->i_last_playlist_id = 0;
diff --git a/src/playlist/playlist_internal.h b/src/playlist/playlist_internal.h
index ba1bfb0..3812edc 100644
--- a/src/playlist/playlist_internal.h
+++ b/src/playlist/playlist_internal.h
@@ -82,6 +82,7 @@ typedef struct playlist_private_t
     vlc_thread_t thread; /**< engine thread */
     vlc_mutex_t lock; /**< dah big playlist global lock */
     vlc_cond_t signal; /**< wakes up the playlist engine thread */
+    bool     killed; /**< playlist is shutting down */
 
     int      i_last_playlist_id; /**< Last id to an item */
     bool     b_reset_currently_playing; /** Reset current item array */
diff --git a/src/playlist/thread.c b/src/playlist/thread.c
index fbcd9de..af4d886 100644
--- a/src/playlist/thread.c
+++ b/src/playlist/thread.c
@@ -75,7 +75,7 @@ void playlist_Deactivate( playlist_t *p_playlist )
     msg_Dbg( p_playlist, "deactivating the playlist" );
 
     PL_LOCK;
-    vlc_object_kill( p_playlist );
+    p_sys->killed = true;
     vlc_cond_signal( &p_sys->signal );
     PL_UNLOCK;
 
@@ -454,7 +454,7 @@ static int LoopInput( playlist_t *p_playlist )
     if( !p_input )
         return VLC_EGENERIC;
 
-    if( ( p_sys->request.b_request || !vlc_object_alive( p_playlist ) ) && !p_input->b_die )
+    if( ( p_sys->request.b_request || p_sys->killed ) && !p_input->b_die )
     {
         PL_DEBUG( "incoming request - stopping current input" );
         input_Stop( p_input, true );
@@ -512,7 +512,7 @@ static void LoopRequest( playlist_t *p_playlist )
     const int i_status = p_sys->request.b_request ?
                          p_sys->request.i_status : p_sys->status.i_status;
 
-    if( i_status == PLAYLIST_STOPPED || !vlc_object_alive( p_playlist ) )
+    if( i_status == PLAYLIST_STOPPED || p_sys->killed )
     {
         p_sys->status.i_status = PLAYLIST_STOPPED;
 
@@ -530,7 +530,7 @@ static void LoopRequest( playlist_t *p_playlist )
         }
         else
         {
-            if( vlc_object_alive( p_playlist ) )
+            if( !p_sys->killed )
                 vlc_cond_wait( &p_sys->signal, &p_sys->lock );
         }
         return;
@@ -563,7 +563,7 @@ static void *Thread ( void *data )
     playlist_private_t *p_sys = pl_priv(p_playlist);
 
     playlist_Lock( p_playlist );
-    while( vlc_object_alive( p_playlist ) || p_sys->p_input )
+    while( !p_sys->killed || p_sys->p_input )
     {
         /* FIXME: what's that ! */
         if( p_sys->b_reset_currently_playing &&



More information about the vlc-commits mailing list