[vlc-devel] commit: playlist: Use vlc_object_alive(). (Pierre d'Herbemont )

git version control git at videolan.org
Sun Mar 30 16:54:21 CEST 2008


vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Sun Mar 30 16:48:58 2008 +0200| [a11817c9ba314e5f4f13d33c24d248f51b6ad2d3]

playlist: Use vlc_object_alive().

We can't do what is advised in the documentation of vlc_object_alive(), but we try to stay close enough of it.

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

 src/playlist/thread.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/playlist/thread.c b/src/playlist/thread.c
index f0ab752..54582e0 100644
--- a/src/playlist/thread.c
+++ b/src/playlist/thread.c
@@ -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 );
 }
 




More information about the vlc-devel mailing list