www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/03/22/14:07:45

From: noer AT cygnus DOT com (Geoffrey Noer)
Subject: Problem with longjmp'ing out of signal handlers
22 Mar 1998 14:07:45 -0800 :
Message-ID: <199803222151.NAA24117.cygnus.cygwin32.developers@rtl.cygnus.com>
To: cygwin32-developers AT cygnus DOT com

Hi all,

Anyone have any suggestions?

A developer here reported:

> I'm am working on getting command-line GDB working under NT, and
> have run into a real show-stopper.  It seems that programs that
> attempt to longjmp out of
> signal handlers simply exit.  The following program illustrates the problem.
> Just run it, and type ^C.  You can see the signal handler being invoked, and
> then the return from sigsetjmp, however the program exits a moment
> later!
[...]
> #include <signal.h>
> #include <stdio.h>
> #include <setjmp.h>
> 
> sigjmp_buf jb;
> 
> static void
> sigint_handler (int foo)
> {
>   printf ("SIGINT handler\n");
> 
>   siglongjmp (jb, 1);
> }
> 
> main ()
> {
>   printf ("hello world\n");
> 
>   signal (SIGINT, sigint_handler);
> 
>   if (sigsetjmp (jb, 1) == 0)
>     printf ("sigsetjmp == 0\n");
>   else
>     printf ("sigsetjmp == 1\n");
> 
>   while (1);
> }
> 


-- 
Geoffrey Noer
noer AT cygnus DOT com

- Raw text -


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