Another sigwaitinfo problem (with testcase)
Daniel Colascione
dancol@dancol.org
Wed Aug 15 08:04:00 GMT 2012
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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20120815/3ccdc5bb/attachment.sig>
More information about the Cygwin
mailing list