water has asked for the wisdom of the Perl Monks concerning the following question:
I have some perl code that needs to be stopped if it runs for more than N seconds. The stop can be brutal; no need to clean up.
The alarm docs warn against mixing alarm and sleep in the same program.
I also want to place the stop-me-if-run-for-more-than-N-secs in a module; the module doesn't know anything about the code that will use it.
Given that, what's the best way to zap a process if it runs too long? Need I spawn another process to kill the parent after a time limit? Is there a system linux flag that accomplish this on the command line? Or is SIGALARM my best bet?
Thanks
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: brutally stop a perl program if it runs too long
by Zaxo (Archbishop) on Sep 13, 2005 at 02:10 UTC | |
by Errto (Vicar) on Sep 13, 2005 at 03:18 UTC | |
Re: brutally stop a perl program if it runs too long
by sgifford (Prior) on Sep 13, 2005 at 06:41 UTC | |
Re: brutally stop a perl program if it runs too long
by radiantmatrix (Parson) on Sep 13, 2005 at 14:30 UTC | |
Re: brutally stop a perl program if it runs too long
by zentara (Archbishop) on Sep 13, 2005 at 11:06 UTC |
Back to
Seekers of Perl Wisdom