On Wed, Mar 19, 2014 at 10:21 PM, Anders Peter Fugmann wrote: > Is printing from a signal handler illegal? FWIW, that is illegal in some operating systems. I have seen it in one case at least: * Linux with threads. printf in C is protected by a mutex. Suppose we are inside the printf, with the mutex locked and then we get a signal. We run the handler, and it wants to print out debug information. Welcome deadlock! * Many system calls are not safe in the signal handler. FreeBSD has a list in sigaction(2) for instance. See http://www.freebsd.org/cgi/man.cgi?query=sigaction&apropos=0&sektion=0&manpath=FreeBSD+10.0-RELEASE&arch=default&format=html In practice, you should probably just set a flag in the signal handler and then handle that in a main loop of the program. Doing advanced stuff in a signal handler is usually dangerous non-compatible territory. -- J.