This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Signal handling in Win32 GUI programs
Actually I still can't quite get signal handling in MinTTY to work
right. SIGINT is fine, but SIGTERM, SIGHUP, and SIGKILL don't seem to
get to sigwait(), instead still invoking the default handler, i.e.
terminating MinTTY without SIGHUP being sent to the command inside it.
Here's what I got:
static const sigset_t term_sigs =
1<<SIGHUP | 1<<SIGKILL | 1<<SIGTERM | 1<<SIGINT;
static void *
signal_thread(void *arg)
{
int sig;
sigwait(&term_sigs, &sig);
puts("signalled");
if (pid)
kill(pid, SIGHUP);
exit(0);
}
And in the main thread:
pthread_sigmask(SIG_BLOCK, &term_sigs, 0);
pthread_t thread;
pthread_create(&thread, 0, signal_thread, 0);
Anything obvious missing?
Andy
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/