in reply to Re: Re: browser cancels request-> forked procs die?
in thread browser cancels request-> forked procs die?
It's up to you to determine what amount of time your child process should normally run, so that you don't interrupt a normally executing process.$SIG{ALRM} = sub { die 'Timeout'; }; alarm( some decent duration ); eval { fork the child here wait for the child (waitpid() or similar) if the child returns reset the alarm (alarm(0)) }; if($@) { if($@ =~ /Timeout/) { # child exceeded authorized run time, so kill it kill(15, $child); } else { handle other fatal problems.... } }
Michael
|
|---|