signals: fix race condition with sigwait()
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Sat, 31 May 2008 16:07:05 +0000 (19:07 +0300)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Sat, 31 May 2008 16:07:05 +0000 (19:07 +0300)
The signal thread may catch a signal before the interface thread is
initialized. We need to check signum before the first wait.

modules/control/signals.c

index b66ba49..deb0984 100644 (file)
@@ -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: