+ libvlc_playlist_play (vlc, -1, 0, NULL);
+
+ /* Wait for a termination signal */
+ pthread_t self = pthread_self ();
+ libvlc_set_exit_handler (vlc, vlc_kill, &self);
+
+ /* 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;
+ sigwait (&set, &signum);
+
+ /* 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 */
+out:
+ if (vlc != NULL)
+ libvlc_release (vlc);
+ for (int i = 2; i < argc; i++)