longjmp() from nested signal handlers
David Keppel
pardo at june.cs.washington.edu
Wed Mar 30 04:08:03 AEST 1988
I got a copy of "Software Engineering in C" by Peter A. Darnell and
Philip E. Margolis from Springer-Verlag. I haven't had a chance to
use it extensively yet, but it seems like a pretty good book. Like
the new edition of K&R, it too, precedes the ANSI standard and has
in it lots of ANSI-related things. To its credit, it was published
early enough that it doesn't have anything in it about "noalias" :->
In the appendix on setjmp()/longjmp() (page 421, A.10.2) the grey
book (:-) says:
If longjmp() is invoked from a nested signal handler (that
is, from a function invoked as a result of a signal raised
during the handling of another signal), the behavior is
undefined. In all other interrupt and signal handling
situations, longjmp() should execute correctly.
My question is: why should this be so?
Seems like this could be a pretty common occurence, say if you had
a (going Un*x here) ^Z handler which was then hit with a ^C, and
like "vi", the semantics of ^C are to jump out to some main loop.
I also don't understand why jumping out of a nested signal handler
is different from jumping out of a non-nested handler. Somebody
here suggested that things might be funny on machines where the
invocation record of the signal handler is pushed onto a special
system stack, but I haven't yet figured out a way that this makes
a difference.
Please get answers to me any way you can!
;-D on ( Thanks in advance and in retrospect, too ) Pardo
pardo at cs.washington.edu ..!ucbvax!uw-beaver!uw-june!pardo
More information about the Comp.lang.c
mailing list