Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!ames!ucbcad!ucbvax!cartan!brahms.Berkeley.EDU!ballou From: ballou@brahms.Berkeley.EDU.UUCP Newsgroups: comp.sys.ibm.pc Subject: Re: help for routine to handle exit conditions Message-ID: <1006@cartan.Berkeley.EDU> Date: Fri, 20-Feb-87 03:38:47 EST Article-I.D.: cartan.1006 Posted: Fri Feb 20 03:38:47 1987 Date-Received: Sat, 21-Feb-87 04:27:23 EST References: <972@unc.unc.UUCP> Sender: news@cartan.Berkeley.EDU Reply-To: ballou@brahms.Berkeley.EDU (Kenneth R. Ballou) Distribution: na Organization: Math Dept. UC Berkeley Lines: 38 In article <972@unc.unc.UUCP> bmh@unc.UUCP (Brad Hemminger) writes: > > Additionally the Manx signal call only allows you to setup a >procedure for one time (apparently) as it resets the interrupt >to the default terminate meaning once your procedure is called. >Does anyone know whether this is because of DOS/PC considerations >or simply a limitation of Manx's code? Remarkably, it is neither. It is for compatibility with the UN*X signal function. UN*X signal resets the signal handler to the default when the signal is received. This leads to code sequences such as: #include main () { int my_signal_handler (); signal (SIGINT, my_signal_handler); /* rest of code for main () */ } int my_signal_handler (signum) int signum; { signal (signum, my_signal_handler); /* restore action for signal signum */ /* rest of code for my_signal_handler () */ } This can lead to interesting race conditions; it is possible for your process to be sent the same signal twice before it has had a chance to reset the signal handler for that particular signal. -------- Kenneth R. Ballou ARPA: ballou@brahms.berkeley.edu Department of Mathematics UUCP: ...!ucbvax!brahms!ballou University of California Berkeley, California 94720