]> git.sesse.net Git - vlc/commitdiff
playlist: Use vlc_object_alive().
authorPierre d'Herbemont <pdherbemont@videolan.org>
Sun, 30 Mar 2008 14:48:58 +0000 (16:48 +0200)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Sun, 30 Mar 2008 14:54:20 +0000 (16:54 +0200)
We can't do what is advised in the documentation of vlc_object_alive(), but we try to stay close enough of it.

src/playlist/thread.c

index f0ab752df741129388d9d27bb15b2621173bc5ed..54582e0a1fffba120e14046876dd66c521b95628 100644 (file)
@@ -148,23 +148,27 @@ static void RunControlThread ( playlist_t *p_playlist )
     /* Tell above that we're ready */
     vlc_thread_ready( p_playlist );
 
-    while( !p_playlist->b_die )
+    vlc_object_lock( p_playlist );
+    while( vlc_object_alive( p_playlist ) )
     {
+        vlc_object_unlock( p_playlist );
         playlist_MainLoop( p_playlist );
+        vlc_object_lock( p_playlist );
+
         if( p_playlist->b_cant_sleep )
         {
             /* 100 ms is an acceptable delay for playlist operations */
+            vlc_object_unlock( p_playlist );
             msleep( INTF_IDLE_SLEEP*2 );
+            vlc_object_lock( p_playlist );
         }
         else
         {
-            PL_LOCK;
-            vlc_bool_t b_die = vlc_object_wait( p_playlist );
-            PL_UNLOCK;
-            if( b_die )
-                break;
+            vlc_object_wait( p_playlist );
         }
     }
+    vlc_object_unlock( p_playlist );
+
     playlist_LastLoop( p_playlist );
 }