Re: Re: Checking for infinite loops
- From: tom@xxxxxxxxxxxxxx (Tom Phoenix)
- Date: Thu, 7 Dec 2006 08:48:42 -0800
On 12/6/06, hOURS <h_ours@xxxxxxxxx> wrote:
My program in a nutshell goes:
Blah blah blah the beginning part
require someprogramthatmayhaveaninfiniteloop.pl
Blah blah blah the ending part
You must have a good reason for using a buggy library without first
fixing its bugs.
How would one add alarm to this such that the ending part gets executed
regardless?
It's difficult to live up to the word "regardless", especially so when
alarm is involved. As an alternative, have you considered using a
child process to do the long-running calculation? It can get stuck in
an infinite loop, but your parent process isn't. Your parent process
can check each second whether the child has finished until N seconds
have elapsed; then the parent sends SIGHUP to the child and it's done.
Hope this helps!
--Tom Phoenix
Stonehenge Perl Training
.
- References:
- Re: Checking for infinite loops
- From: D. Bolliger
- Re: Checking for infinite loops
- From: hOURS
- Re: Checking for infinite loops
- Prev by Date: Re: Trouble accessing parsed XML variable
- Next by Date: Using connect_cached
- Previous by thread: Re: Checking for infinite loops
- Next by thread: Re: Checking for infinite loops
- Index(es):
Relevant Pages
|