Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://992707]
[marto]: good morning all
[karlgoethebier]: good morning

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2017-06-29 07:40 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (655 votes). Check out past polls.