Browse Source

vlc: use signal handlers rather than sigwait() for SIGCHLD

This works around Qt4 QProcess getting stuck waiting for its
SIGCHLD signal handler to be called.
pull/2/head
Rémi Denis-Courmont 16 years ago
parent
commit
d1ca34ed5b
  1. 13
      bin/vlc.c

13
bin/vlc.c

@ -221,14 +221,19 @@ int main( int i_argc, const char *ppsz_argv[] )
pthread_t self = pthread_self ();
libvlc_set_exit_handler (vlc, vlc_kill, &self);
if (signal_ignored (SIGHUP)) /* <- needed to handle nohup properly */
/* Qt4 insists on catching SIGCHLD via signal handler. To work around that,
* unblock it after all our child threads are created. */
sigdelset (&set, SIGCHLD);
pthread_sigmask (SIG_SETMASK, &set, NULL);
/* Do not dequeue SIGHUP if it is ignored (nohup) */
if (signal_ignored (SIGHUP))
sigdelset (&set, SIGHUP);
/* Ignore SIGPIPE */
sigdelset (&set, SIGPIPE);
int signum;
do
sigwait (&set, &signum);
while (signum == SIGCHLD);
sigwait (&set, &signum);
/* Restore default signal behaviour after 3 seconds */
sigemptyset (&set);

Loading…
Cancel
Save