home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / programm / 6056 < prev    next >
Encoding:
Internet Message Format  |  1993-01-27  |  2.0 KB

  1. 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
  2. From: rturner@imagen.com (Randy Turner)
  3. Newsgroups: comp.unix.programmer
  4. Subject: Re: longjmp() from a signal handler
  5. Keywords: longjmp signals
  6. Message-ID: <rturner.728076215@imagen>
  7. Date: 26 Jan 93 19:23:35 GMT
  8. References: <rturner.727977268@imagen> <1993Jan26.132457.26298@g2syd.genasys.com.au>
  9. Sender: usenet@imagen.com
  10. Organization: imagen
  11. Lines: 30
  12.  
  13. michaelh@g2syd.genasys.com.au (Michael Haldey) writes:
  14.  
  15. >In article <rturner.727977268@imagen> rturner@imagen.com (Randy Turner) writes:
  16. >>I was reading the POSIX.1 standard the other day and it mentions that you
  17. >>cannot use the longjmp() library routine from inside a signal handler.  I
  18. >>was under the impression that this was valid under BSD 4.3...Can 
  19. >>anyone confirm the compatibility of using longjmp() from a signal handler
  20. >>when trying to write portable code?
  21. >>
  22. >As far as I remember, it is not compatible. Therre are two functions:
  23. >siglongjmp and sigsetjmp which are supported by POSIX and you can use
  24. >them freely. The reason is a behavour of the signal mask.
  25.  
  26. >My 0.002
  27. >Michael
  28. >-- 
  29. >Michael Haldey  |  Genasys II Pty Ltd, Sydney, Australia
  30. >                |  Phone:    +61-2-954-2878 (-9930 FAX)
  31. >                |  Internet: michaelh@g2syd.genasys.com.au
  32.  
  33.    But from within a signal handler, even siglongjmp() is not compatible.
  34.    I think the problem stems from the fact that signal delivery is an
  35.    implementation-specific issue and that POSIX cannot guarantee that the
  36.    runtime stack the signal is delivered on is the same runtime stack that
  37.    the the jmp_buf[] references.  The POSIX.1 spec says that only a subset
  38.    of library calls are safe to call from inside a signal handler, and the
  39.    longjmp()/siglongjmp() calls are not among them.  I was curious if
  40.    Sys-V/R4 supports longjmp'ing from a signal handler, or is anyone has
  41.    code that does this?
  42.                 Randy
  43.