[vlc-devel] commit: playlist: Fix a possible dead lock when the playlist is killed. ( Pierre d'Herbemont )

git version control git at videolan.org
Sun Mar 30 19:01:59 CEST 2008


vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Sun Mar 30 19:02:00 2008 +0200| [6aea931967cfdb0e3d0ae5161bac9d25fa2d41b8]

playlist: Fix a possible dead lock when the playlist is killed.

We do maintain a lock around vlc_object_alive() because we want to make sure we won't miss the point when a concurrent thread will call vlc_object_kill(), that is set b_die and vlc_object_signal(). If we missed b_die and the signal, next vlc_object_wait() will dead lock.

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

 src/playlist/thread.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/playlist/thread.c b/src/playlist/thread.c
index 0d6919f..1a5061e 100644
--- a/src/playlist/thread.c
+++ b/src/playlist/thread.c
@@ -155,6 +155,11 @@ static void RunControlThread ( playlist_t *p_playlist )
         playlist_MainLoop( p_playlist );
         PL_LOCK;
 
+        /* The playlist lock has been unlocked, so we can't tell if
+         * someone has killed us in the meantime. Check now. */
+        if( !vlc_object_alive( p_playlist ) )
+            break;
+
         if( p_playlist->b_cant_sleep )
         {
             /* 100 ms is an acceptable delay for playlist operations */




More information about the vlc-devel mailing list