http://www.perlmonks.org?node_id=1051670

Greetings, all! I am an amateur programmer, and a first-time poster on PerlMonks so please forgive any impertinence I might have, but it appears to me that the current implementation of SIGHUP in Win32 Perl (the following code is from win32.c):

BOOL WINAPI win32_ctrlhandler(DWORD dwCtrlType) { #ifdef MULTIPLICITY dTHXa(PERL_GET_SIG_CONTEXT); if (!my_perl) return FALSE; #endif switch(dwCtrlType) { case CTRL_CLOSE_EVENT: /* A signal that the system sends to all processes attached to a + console when the user closes the console (either by choosing the Close command from the console window's System menu, or by choosing the End Task com +mand from the Task List */ if (do_raise(aTHX_ 1)) /* SIGHUP */ sig_terminate(aTHX_ 1); return TRUE;

is one function call away from being very useful.

If the return TRUE; was preceded by a Sleep(950); then a $SIG{ HUP } handler in a user's program would have about 9 and one-half seconds to clean itself up before being forcibly terminated by the OS. (Windows 7 terminates such processes after approximately 10 seconds). My understanding is that the OS terminates these processes upon the return from the handler, so currently, there is no time for a SIGHUP handler to effectively do anything.

None of this affects Linux in any way, this is just a Win32 thing. The code above operates in a different thread from the Perl program, so the Sleep() would not affect the main program at all. What do you think?