Commit 0054378d authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

Fix a hang when quitting vlc on Mac OS X. This hang is due to the signal...

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.
parent 7cdfb7ee
...@@ -177,6 +177,12 @@ int main( int i_argc, char *ppsz_argv[] ) ...@@ -177,6 +177,12 @@ int main( int i_argc, char *ppsz_argv[] )
#if !defined(WIN32) && !defined(UNDER_CE) #if !defined(WIN32) && !defined(UNDER_CE)
pthread_cancel (sigth); 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); pthread_join (sigth, NULL);
#endif #endif
...@@ -201,6 +207,12 @@ static void *SigHandler (void *data) ...@@ -201,6 +207,12 @@ static void *SigHandler (void *data)
int i_signal, state; int i_signal, state;
(void)sigwait (set, &i_signal); (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 /* Once a signal has been trapped, the termination sequence will be
* armed and subsequent signals will be ignored to avoid sending * armed and subsequent signals will be ignored to avoid sending
* signals to a libvlc structure having been destroyed */ * signals to a libvlc structure having been destroyed */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment