Check cond_wait() return value - Fix a deadlock
authorRafaël Carré <funman@videolan.org>
Sun, 30 Mar 2008 14:43:54 +0000 (16:43 +0200)
committerRafaël Carré <funman@videolan.org>
Sun, 30 Mar 2008 14:44:53 +0000 (16:44 +0200)
Remove useless variable

src/playlist/thread.c

index 8d2bd71..f0ab752 100644 (file)
@@ -145,14 +145,11 @@ int playlist_ThreadDestroy( playlist_t * p_playlist )
  */
 static void RunControlThread ( playlist_t *p_playlist )
 {
-    int i_loops = 0;
-
     /* Tell above that we're ready */
     vlc_thread_ready( p_playlist );
+
     while( !p_playlist->b_die )
     {
-        i_loops++;
-
         playlist_MainLoop( p_playlist );
         if( p_playlist->b_cant_sleep )
         {
@@ -162,8 +159,10 @@ static void RunControlThread ( playlist_t *p_playlist )
         else
         {
             PL_LOCK;
-            vlc_cond_wait( &p_playlist->object_wait, &p_playlist->object_lock );
+            vlc_bool_t b_die = vlc_object_wait( p_playlist );
             PL_UNLOCK;
+            if( b_die )
+                break;
         }
     }
     playlist_LastLoop( p_playlist );