This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Another sigwaitinfo problem (with testcase)


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;
}

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]