No such thing as a small change | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
When the p5p guys added the system 1, ... asynchronous spawn, they wanted it to operate as much like the *nix equivalent as possible. Under *nix, a spawned process will hang around after it completes, as a zombie, until someone calls wait or waitpid to retrieve its exit status and clean it up. Win32 didn't provide a direct equivalent of this facility, so they chose to emulate it within the Perl process. To do this, they store the process handles and pids in an internal data structure, so that the can emulate wait and waitpid.
However, the mechanism they chose to use for the wait & waitpid emulation has a limit of 64 elements, so when you try to spawn a 65th process, without having called wait or waitpid in the interim, they reject the attempt because the fixed sized tables (internal to the Perl process) have temporarially run out of resources.
So, if you need to start more than 64 processes this way, you will need to clean up your zombies using wait as you go. However, there is another alternative built-in. usage: Win32::Spawn($cmdName, $args, $PID).
This doesn't attempt to emulate *nix mechanisms, and so doesn't have any limitations that arise from doing so. It also returns the real pid directly which can be useful. Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
In reply to Re: spawning windows children (revisted)
by BrowserUk
|
|