Another sigwaitinfo problem (with testcase)

Daniel Colascione
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>

    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");

    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: <>

More information about the Cygwin mailing list