delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/07/24/07:37:24

From: joachim AT bach DOT informatik DOT uni-ulm DOT de (Joachim Schmid)
Subject: Problems with setjmp and signals
24 Jul 1997 07:37:24 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199707241149.NAA03148.cygnus.gnu-win32@bizet>
Original-To: gnu-win32 AT cygnus DOT com
X-Sun-Charset: US-ASCII
Original-Sender: owner-gnu-win32 AT cygnus DOT com

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 AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019