home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!opl.com!hri.com!noc.near.net!news.Brown.EDU!qt.cs.utexas.edu!cs.utexas.edu!sun-barr!male.EBay.Sun.COM!exodus.Eng.Sun.COM!sun!imagen!imagen!rturner
- From: rturner@imagen.com (Randy Turner)
- Newsgroups: comp.unix.programmer
- Subject: Re: longjmp() from a signal handler
- Keywords: longjmp signals
- Message-ID: <rturner.728076215@imagen>
- Date: 26 Jan 93 19:23:35 GMT
- References: <rturner.727977268@imagen> <1993Jan26.132457.26298@g2syd.genasys.com.au>
- Sender: usenet@imagen.com
- Organization: imagen
- Lines: 30
-
- michaelh@g2syd.genasys.com.au (Michael Haldey) writes:
-
- >In article <rturner.727977268@imagen> rturner@imagen.com (Randy Turner) writes:
- >>I was reading the POSIX.1 standard the other day and it mentions that you
- >>cannot use the longjmp() library routine from inside a signal handler. I
- >>was under the impression that this was valid under BSD 4.3...Can
- >>anyone confirm the compatibility of using longjmp() from a signal handler
- >>when trying to write portable code?
- >>
- >As far as I remember, it is not compatible. Therre are two functions:
- >siglongjmp and sigsetjmp which are supported by POSIX and you can use
- >them freely. The reason is a behavour of the signal mask.
-
- >My 0.002
- >Michael
- >--
- >Michael Haldey | Genasys II Pty Ltd, Sydney, Australia
- > | Phone: +61-2-954-2878 (-9930 FAX)
- > | Internet: michaelh@g2syd.genasys.com.au
-
- But from within a signal handler, even siglongjmp() is not compatible.
- I think the problem stems from the fact that signal delivery is an
- implementation-specific issue and that POSIX cannot guarantee that the
- runtime stack the signal is delivered on is the same runtime stack that
- the the jmp_buf[] references. The POSIX.1 spec says that only a subset
- of library calls are safe to call from inside a signal handler, and the
- longjmp()/siglongjmp() calls are not among them. I was curious if
- Sys-V/R4 supports longjmp'ing from a signal handler, or is anyone has
- code that does this?
- Randy
-