]> git.sesse.net Git - vlc/commitdiff
signals: Workaround the fact that sigwait() isn't a pthread cancellation point on...
authorPierre d'Herbemont <pdherbemont@videolan.org>
Thu, 29 May 2008 21:47:17 +0000 (23:47 +0200)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Thu, 29 May 2008 21:47:17 +0000 (23:47 +0200)
modules/control/signals.c

index c9fd67e492c19095fcbaf8f3d801049572444500..5180aa702e80a0a57adad9d11d1100639d4b2daa 100644 (file)
@@ -78,6 +78,12 @@ static void Close (vlc_object_t *obj)
     intf_sys_t *p_sys = intf->p_sys;
 
     pthread_cancel (p_sys->thread);
+#ifdef __APPLE__
+   /* In Mac OS X up to 10.5 sigwait (among others) is not a pthread
+    * cancellation point, so we throw a dummy quit signal to end
+    * sigwait() in the sigth thread */
+    pthread_kill (p_sys->thread, SIGQUIT);
+# endif
     pthread_join (p_sys->thread, NULL);
     free (p_sys);
 }
@@ -102,6 +108,12 @@ static void *SigThread (void *data)
 
         sigwait (&set, &signum);
 
+#ifdef __APPLE__
+        /* In Mac OS X up to 10.5 sigwait (among others) is not a pthread
+         * cancellation point */
+        pthread_testcancel();
+#endif
+
         vlc_object_lock (obj);
         p_sys->signum = signum;
         vlc_object_signal_unlocked (obj);