Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

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]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2017-03-26 09:31 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (313 votes). Check out past polls.