Signals: only one thread needed now
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Wed, 3 Sep 2008 19:30:41 +0000 (22:30 +0300)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Wed, 3 Sep 2008 19:46:21 +0000 (22:46 +0300)
modules/control/signals.c

index 9316d21..9c945c3 100644 (file)
@@ -31,7 +31,6 @@
 
 static int  Open (vlc_object_t *);
 static void Close (vlc_object_t *);
-static void Run (intf_thread_t *);
 static void *SigThread (void *);
 
 vlc_module_begin ();
@@ -67,7 +66,7 @@ static int Open (vlc_object_t *obj)
         return VLC_ENOMEM;
     }
 
-    intf->pf_run = Run;
+    intf->pf_run = NULL;
     return 0;
 }
 
@@ -113,21 +112,7 @@ static void *SigThread (void *data)
         vlc_testcancel();
 #endif
 
-        vlc_object_lock (obj);
-        p_sys->signum = signum;
-        vlc_object_signal_unlocked (obj);
-        vlc_object_unlock (obj);
-    }
-}
-
-static void Run (intf_thread_t *obj)
-{
-    intf_sys_t *p_sys = obj->p_sys;
-
-    vlc_object_lock (obj);
-    while (vlc_object_alive (obj))
-    {
-        switch (p_sys->signum)
+        switch (signum)
         {
             case SIGINT:
             case SIGHUP:
@@ -135,12 +120,8 @@ static void Run (intf_thread_t *obj)
             case SIGQUIT:
                 msg_Err (obj, "Caught %s signal, exiting...",
                          strsignal (p_sys->signum));
-                goto out;
+                vlc_object_kill (obj->p_libvlc);
+                break;
         }
-        vlc_object_wait (obj);
     }
-
-out:
-    vlc_object_unlock (obj);
-    vlc_object_kill (obj->p_libvlc);
 }