Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: fork report child finish by order child process finish.

by aitap (Deacon)
on Sep 10, 2012 at 09:20 UTC ( #992707=note: print w/ replies, xml ) Need Help??


in reply to fork report child finish by order child process finish.

Unless you are training yourself, it should be easier to use Parallel::ForkManager and its run_on_finish callback.

Manual way to do this is sequentially running waitpid with WHOHANG flag and checking its return value for all pids running. Example (untested):

foreach my $process (@child_pids) { if (waitpid($process->{PID}, WNOHANG)) { print "Process $process->{PROCESS} terminated\n"; } }

Sorry if my advice was wrong.


Comment on Re: fork report child finish by order child process finish.
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2015-01-26 09:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My top resolution in 2015 is:

















    Results (189 votes), past polls