in reply to Stop fork in Parallel::ForkManager
So you want to exit all children when you get the signal? Or just the child that recieved the signal?
Finishing a child is easy enough - you can call the $pm->finish if (...signal...).
To kill all children you'll have to keep a track of the currently active pids for the children and kill them yourself, Parallel::ForkManager doesn't have built in facilities for this ( as far as i am aware at least! ). Information on how to do this can be found in : Parallel::ForkManager question.
I am not sure what the best way to set off the infanticide would be though, I guess having a subroutine which accesses the list of pids, but there might well be stability issues, i.e. the child calls the sub, which kills the child... so you would have to make sure it is the original parent process that does the killing, and i am not sure how you would do this.
This way seems nasty though, and hopefully someone has a better idea!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Stop fork in Parallel::ForkManager
by BioLion (Curate) on Sep 28, 2009 at 11:28 UTC |