# example { # this scope is here just to localize the signal handler local $SIG{ALRM} = sub { die "timeout\n" }; alarm $TIMEOUT; eval { # iffy code 1; } or do { die $@ unless $@ eq "timeout\n"; # propagate other exceptions # handle timeout }; alarm 0; # free alarm }
In reply to Re: Reliable Timeout
by gaal
in thread Reliable Timeout
by Eyck
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |