Commit 63a90105 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

signals: let the default handlers kill VLC after 3 seconds

This should only be used if VLC deadlocks, or takes an awfully long time
to clean up. That will let VLC be killed as with the older signals
handler.
parent 552b93b4
...@@ -88,6 +88,7 @@ static void *SigThread (void *data) ...@@ -88,6 +88,7 @@ static void *SigThread (void *data)
{ {
intf_thread_t *obj = data; intf_thread_t *obj = data;
sigset_t set; sigset_t set;
int signum;
sigemptyset (&set); sigemptyset (&set);
sigaddset (&set, SIGHUP); sigaddset (&set, SIGHUP);
...@@ -97,10 +98,8 @@ static void *SigThread (void *data) ...@@ -97,10 +98,8 @@ static void *SigThread (void *data)
sigaddset (&set, SIGCHLD); sigaddset (&set, SIGCHLD);
for (;;) do
{ {
int signum;
sigwait (&set, &signum); sigwait (&set, &signum);
#ifdef __APPLE__ #ifdef __APPLE__
...@@ -108,17 +107,15 @@ static void *SigThread (void *data) ...@@ -108,17 +107,15 @@ static void *SigThread (void *data)
* cancellation point */ * cancellation point */
vlc_testcancel(); vlc_testcancel();
#endif #endif
switch (signum)
{
case SIGINT:
case SIGHUP:
case SIGTERM:
case SIGQUIT:
msg_Err (obj, "Caught %s signal, exiting...",
strsignal (signum));
libvlc_Quit (obj->p_libvlc);
break;
}
} }
while (signum == SIGCHLD);
msg_Err (obj, "Caught %s signal, exiting...", strsignal (signum));
libvlc_Quit (obj->p_libvlc);
/* After 3 seconds, fallback to normal signal handling */
msleep (3 * CLOCK_FREQ);
pthread_sigmask (SIG_UNBLOCK, &set, NULL);
for (;;)
pause ();
} }
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