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?

In reply to The implementation of SIGHUP in Win32 Perl by klaten

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.