This section from perlman:perlwin32 (from the AS 5.8 (805) distribution) gives a hint to the problem:

Signal handling may not behave as on Unix platforms (where it doesn't exactly ``behave'', either :). For instance, calling die() or exit() from signal handlers will cause an exception, since most implementations of signal() on Win32 are severely crippled. Thus, signals may work only for simple things like setting a flag variable in the handler. Using signals under this port should currently be considered unsupported.

That said, you appear to be trying to use the signal handler to reap zombied processes, which is not required under AS builds of perl as fork'd processes aren't actually processes, they are implemented as (Win32 native!) threads rather than Unix style COW processes.

The upshot of that is that you don't need to reap forked processes under AS, when the 'process' exit's (or simply falls off the end of the script) the thread goes away and no further action need be taken.

If your script is only to run under Win32, then this actually simplifies the code. If you need to make it portable, then you need to test for platform and install the signal handler conditionally.

You should also read perlman:perlfork from the AS distribution for further details on the differences between their implementation and the standard unix version.


Examine what is said, not who speaks.
1) When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.
2) The only way of discovering the limits of the possible is to venture a little way past them into the impossible
3) Any sufficiently advanced technology is indistinguishable from magic.
Arthur C. Clarke.

In reply to Re: Re: fork() and signal handlers on Windows by BrowserUk
in thread fork() and signal handlers on Windows by BunMan

Title:
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, details, 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, summary, 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.