From: Pierre d'Herbemont Date: Thu, 1 Mar 2007 21:38:58 +0000 (+0000) Subject: Fix a hang when quitting vlc on Mac OS X. This hang is due to the signal thread that... X-Git-Tag: 0.9.0-test0~8351 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=0054378d6e90f6796759fca438a5ff209e19fbf8;p=vlc Fix a hang when quitting vlc on Mac OS X. This hang is due to the signal thread that isn't cancelled properly, because Mac OS X's sigwait is not a pthread cancellation point as it ought to be according to POSIX.1. --- diff --git a/src/vlc.c b/src/vlc.c index e575bb285f..defa5c11df 100644 --- 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 */