This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
Problems with setjmp and signals
- To: gnu-win32 at cygnus dot com
- Subject: Problems with setjmp and signals
- From: joachim at bach dot informatik dot uni-ulm dot de (Joachim Schmid)
- Date: Thu, 24 Jul 1997 13:49:41 +0200
Hallo,
Consider the following example:
#include <setjmp.h>
#include <signal.h>
#include <stdio.h>
static jmp_buf catch;
void handler(int sig) {
signal(SIGINT,handler);
longjmp(catch,0);
}
int main() {
setjmp(catch);
signal(SIGINT,handler);
printf("starting\n");
while (1) sleep(1);
return 0;
}
Compiling and running under unix has the expected result. The programs starts
and prints the message "starting". For each Ctr-C it prints the text
"starting" again.
Und gnu-win32 b18, the first Ctrl-C is catched by the signal handler, but
all other Ctr-C are ignored.
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".