in reply to Re: Fork/Spawn
in thread Fork/Spawn
If you're going to fork off children, be sure to read the section on SIGNALS in perlipc. You might even do something like this, in your child processes:alarm 10; # send me a signal in 10 seconds # do some code which may not complete alarm 0; # if we get here in time, disable the alarm
eval { local $SIG{ALRM} = sub { die "child process took too long to compl +ete" }; alarm 10; # do whatever your little heart desires, hope it's fast enough alarm 0; # whew, just made it }; if ($@ && $@ !~ /alarm clock restart/) { # abort the child process gra +cefully } else { # send the parent the information ? }
|
|---|