in reply to Making Timeout for Yourself
This is not meant to be a criticism of your code, as I really haven't looked at it much. If it works, and you understand it, then you should probably stick with it. If I were to do this, though, I think I would go with an alarm for the timeout. This is recommended by perldoc -q timeout, and is quite simple to use. Here's an example from perldoc -f alarm:
eval { local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required alarm $timeout; $nread = sysread SOCKET, $buffer, $size; alarm 0; }; if ($@) { die unless $@ eq "alarm\n"; # propagate unexpected errors # timed out } else { # didn't }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Making Timeout for Yourself
by pg (Canon) on Dec 31, 2003 at 21:17 UTC | |
by revdiablo (Prior) on Jan 01, 2004 at 01:23 UTC | |
|
Re: Re: Making Timeout for Yourself
by mcogan1966 (Monk) on Dec 31, 2003 at 20:47 UTC |