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

After 3 seconds, allow SIGINT to kill the process

Older versions did that too, and it can be quite useful when debugging.
parent de68b129
...@@ -74,6 +74,11 @@ static void vlc_kill (void *data) ...@@ -74,6 +74,11 @@ static void vlc_kill (void *data)
pthread_kill (*ps, SIGTERM); pthread_kill (*ps, SIGTERM);
} }
static void exit_timeout (int signum)
{
(void) signum;
signal (SIGINT, SIG_DFL);
}
/***************************************************************************** /*****************************************************************************
* main: parse command line, start interface and spawn threads. * main: parse command line, start interface and spawn threads.
...@@ -221,6 +226,15 @@ int main( int i_argc, const char *ppsz_argv[] ) ...@@ -221,6 +226,15 @@ int main( int i_argc, const char *ppsz_argv[] )
sigwait (&set, &signum); sigwait (&set, &signum);
while (signum == SIGCHLD); while (signum == SIGCHLD);
/* Restore default signal behaviour after 3 seconds */
sigemptyset (&set);
sigaddset (&set, SIGINT);
sigaddset (&set, SIGALRM);
signal (SIGINT, SIG_IGN);
signal (SIGALRM, exit_timeout);
pthread_sigmask (SIG_UNBLOCK, &set, NULL);
alarm (3);
/* Cleanup */ /* Cleanup */
out: out:
if (vlc != NULL) if (vlc != NULL)
......
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