home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.arch      Apparently more than just beeps & boops      131,241 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 129,695 of 131,241   
   Anton Ertl to Scott Lurndal   
   Re: Register windows   
   17 Sep 25 05:55:02   
   
   From: anton@mips.complang.tuwien.ac.at   
      
   scott@slp53.sl.home (Scott Lurndal) writes:   
   >MitchAlsup  writes:   
   >>Or longjump out of 'signal' handlers.   
   >   
   >Again, one must take the appropriate care.  Such as   
   >using the correct API (e.g. POSIX siglongjmp(2)).   
      
   The restrictions on siglongjmp() when jumping out of signal handlers   
   are the same as for longjmp().  See the section "Application Usage" in   
   https://pubs.opengroup.org/onlinepubs/9799919799/functions/longjmp.html   
      
   The only difference is that sigsetjmp() saves the signal mask and   
   siglongjmp() restores it.   
      
   >It is quite common to use siglongjmp to leave   
   >a SIGINT (Control-C) handler.   
      
   In Gforth we certainly use longjmp() to leave the SIGINT handler as   
   well as a number of synchronous-signal handlers in Gforth (Gforth does   
   nothing with signal masks, so sigsetjmp()/siglongjmp() would make no   
   difference).  Of course, there is the possibility that the signal   
   handler is invoked while some internal structure of an   
   async-signal-unsafe function such as malloc() or fwrite() is in an   
   inconsistent state, and then we will see breakage, but I have not seen   
   that yet, and nobody has complained.   
      
   The safe approach would be to set a flag in the SIGINT handler, and   
   check that flag in safe places, but relatively frequently (e.g., just   
   before a loop-back edge in the Forth program).   
      
   - anton   
   --   
   'Anyone trying for "industrial quality" ISA should avoid undefined behavior.'   
     Mitch Alsup,    
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca