[vlc-devel] commit: signals: fix race condition with sigwait() ( Rémi Denis-Courmont )

git version control git at videolan.org
Sat May 31 18:05:45 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat May 31 19:07:05 2008 +0300| [ed6a92ec6518a92167dca6c3ebb90c42c9c3de53]

signals: fix race condition with sigwait()

The signal thread may catch a signal before the interface thread is
initialized. We need to check signum before the first wait.

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

 modules/control/signals.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/modules/control/signals.c b/modules/control/signals.c
index b66ba49..deb0984 100644
--- a/modules/control/signals.c
+++ b/modules/control/signals.c
@@ -128,8 +128,6 @@ static void Run (intf_thread_t *obj)
     vlc_object_lock (obj);
     while (vlc_object_alive (obj))
     {
-        vlc_object_wait (obj);
-
         switch (p_sys->signum)
         {
             case SIGINT:
@@ -140,6 +138,7 @@ static void Run (intf_thread_t *obj)
                          strsignal (p_sys->signum));
                 goto out;
         }
+        vlc_object_wait (obj);
     }
 
 out:




More information about the vlc-devel mailing list