Signal handlers should be written in a way that does not result in any unwanted side-effects, e.g. alteration, signal mask alteration, signal disposition change, and other global process attribute changes. Use of non-reentrant functions, e.g., or , inside signal handlers is also unsafe. In particular, the POSIX specification and the Linux man page require that all system functions directly or "indirectly" called from a signal function are "async-signal safe". The man page gives a list of such async-signal safe system functions (practically the system calls), otherwise it is an undefined behavior. It is suggested to simply set some variable in a signal handler, and to test it elsewhere.