in reply to Re: fork() and signal handlers on Windows
in thread fork() and signal handlers on Windows
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.
|
|---|