X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fcontrol%2Fsignals.c;h=6d9c87e3ff72a0986f10901b41387968abbfe7cc;hb=a5c83dda798f93cc7a76bbb50d89352117e6ec46;hp=c9fd67e492c19095fcbaf8f3d801049572444500;hpb=0efa83acc9ea7758bceae38f0e0e5453c7239e20;p=vlc diff --git a/modules/control/signals.c b/modules/control/signals.c index c9fd67e492..6d9c87e3ff 100644 --- a/modules/control/signals.c +++ b/modules/control/signals.c @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include @@ -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); @@ -114,7 +126,7 @@ static void Run (intf_thread_t *obj) intf_sys_t *p_sys = obj->p_sys; vlc_object_lock (obj); - do + while (vlc_object_alive (obj)) { switch (p_sys->signum) { @@ -126,8 +138,8 @@ static void Run (intf_thread_t *obj) strsignal (p_sys->signum)); goto out; } + vlc_object_wait (obj); } - while (!vlc_object_wait (obj)); out: vlc_object_unlock (obj);