When run on a Linux machine, this program starts up and blocks on sigwaitinfo. You can suspend and resume the program using usual job control facilities, and on SIGINT, the program prints a message and exits. When the program resumes after being stopped, it prints "resumed".
With the 2012-08-07 Cygwin snapshot, this program prints "resumed" immediately after receiving SIGTSTP, then fails to respond to any signal, even signals not in the blocked set. A simpler test program that just calls "raise (SIGSTOP)" property stops itself before resuming execution. #define _GNU_SOURCE 1 #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <signal.h> #include <pthread.h> int main() { sigset_t waitmask; int sig; sigemptyset (&waitmask); sigaddset (&waitmask, SIGTSTP); sigaddset (&waitmask, SIGINT); sigprocmask (SIG_BLOCK, &waitmask, NULL); for (;;) { sig = sigwaitinfo (&waitmask, NULL); fprintf (stderr, "got %s\n", sys_siglist[sig]); if (sig == SIGTSTP) { raise (SIGSTOP); /* Block until somebody resumes us. */ } else if (sig == SIGINT) { fprintf(stderr, "exiting"); break; } } return 0; }
signature.asc
Description: OpenPGP digital signature