]> git.sesse.net Git - vlc/commitdiff
Fix a hang when quitting vlc on Mac OS X. This hang is due to the signal thread that...
authorPierre d'Herbemont <pdherbemont@videolan.org>
Thu, 1 Mar 2007 21:38:58 +0000 (21:38 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Thu, 1 Mar 2007 21:38:58 +0000 (21:38 +0000)
src/vlc.c

index e575bb285f1726ae7610707246401d6ae0881c1d..defa5c11dfbb2ba1b925445bd6630c8c28d8151a 100644 (file)
--- a/src/vlc.c
+++ b/src/vlc.c
@@ -177,6 +177,12 @@ int main( int i_argc, char *ppsz_argv[] )
 
 #if !defined(WIN32) && !defined(UNDER_CE)
     pthread_cancel (sigth);
+# ifdef __APPLE__
+    /* In Mac OS X up to 10.4.8 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 (sigth, SIGQUIT);
+# endif
     pthread_join (sigth, NULL);
 #endif
 
@@ -201,6 +207,12 @@ static void *SigHandler (void *data)
         int i_signal, state;
         (void)sigwait (set, &i_signal);
 
+#ifdef __APPLE__
+        /* In Mac OS X up to 10.4.8 sigwait (among others) is not a pthread
+         * cancellation point */
+        pthread_testcancel();
+#endif
+
         /* Once a signal has been trapped, the termination sequence will be
          * armed and subsequent signals will be ignored to avoid sending
          * signals to a libvlc structure having been destroyed */