It is important to note that the signal
function behaves a little differently in Windows than it does on Linux/BSD systems. When a signal handler is installed with the signal
function in Windows, after the signal is triggered once, the default action is restored for that signal. Conversely, Linux/BSD systems leave the signal handler defined by the user in place until it is explicitly removed. If you desire this latter behavior on a Windows system, a standards-compliant solution is to rebind the signal to the handler in the first line of the handler itself:
void handler(int signum) { signal(signum, handler); /* rest of handling code */ }