Keep It Simple, Stupid | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Sigh. Look. You want to reap the children yourself, right?
Stop invoking the magic of the signal handler and do it
your own bad self. Oh, and stop re-installing the signal
handler until you know you need to do it.
The idea would be like this Obviously, this is pretty quickly written code - several declarations and initializations are left as an excercise to the reader :) Notice I wait 1,000 seconds before giving up. You really ought to make the a variable set on the command line. The sleep loop is actually pretty tight. You could, depending on how long lived the processes are, make it longer. Use sleep() if the interval is greater than 1 second. The spawning loop can be much fancier as well - I have several examples that wait for a child to finish and then spawn another off until there are no more jobs to be done. You can pass information into the SPAWN routine ( like the name of the file the child process is handling ) and print nicer messages. I have several refinements on this idea, if you are interested but I haven't the free time to go into all of them. Email me ( mik at speed dot stdio dot com ) if you would like to see them. In reply to Re: Waiting..
by mikfire
|
|