Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Forking and running all child processes at the same time

by jimbojones (Friar)
on Jun 06, 2005 at 14:34 UTC ( #463922=note: print w/ replies, xml ) Need Help??


in reply to Re: Forking and running all child processes at the same time
in thread Forking and running all child processes at the same time

Hi
As pointed out by BrowserUK in this node Re: Unix Review column, your:

1 while wait > 0; # avoid zombies
won't work on windows systems. The windows implementation uses the negative of the thread ID as the pid, so wait returns negative numbers for all children.

It seems the most cross-platform wait statement is:
1 while wait != -1 ; # avoid zombies
since the main thread is ID 1, and the child threads won't have that ID. And it's what wait natively returns when there are no further child processes.

- j


Comment on Re^2: Forking and running all child processes at the same time
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://463922]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (16)
As of 2014-08-21 15:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (136 votes), past polls