weave@chopin.udel.edu (Ken Weaverling) (02/19/91)
In article <1991Feb13.233750.13206@athena.mit.edu> jik@athena.mit.edu (Jonathan I. Kamens) writes: > > Your program should keep track of when curses is activated and when it >isn't. It should then install signal handlers for all of the fatal signals, >and when it gets such a signal, restore the tty modes, remove the signal >handler, and send itself the signal again (to get a coredump, which you >presumably want for debugging). Gads, I hate to bring this subject back up, for fear of igniting another 100 message thread on "what can I call from a signal handler" but this is a variation of that. Above, you mention retoring tty modes, then sending a signal again. This implies a system call or two within the signal handler. So my question is: Is it safe to call a system function from a signal handler IFF THE HANDLER NEVER DOES A RETURN and intends to exit() at the end of the handler? I presume so since even if function isn't re-entrant, your first interrupted call isn't going to resume again. I had been up to now doing a longjmp back to main() and then performing cleanup from that level. However, if I trap a seg violation and want to send the signal again to get a core dump, it is useless since I already popped the stack to kingdom come!!!! -- >>>---> Ken Weaverling >>>----> weave@brahms.udel.edu