Subject: | Nested timeouts don't work with Time::HiRes |
If Time::HiRes is loaded, nested timeouts don't work. Here is my test script:
use strict;
use warnings;
use Time::Out qw(timeout) ;
printf "Version: %s\n", $Time::Out::VERSION;
timeout 3 => sub {
timeout 1 => sub {
sleep 3;
} ;
if ($@){
print "inner timeout\n";
} else {
print "inner normal\n";
}
sleep 5;
} ;
if ($@){
print "timeout\n";
} else {
print "normal\n";
}
And now two diffent runs:
# One without Time::HiRes. This is what I expect:
Show quoted text
> time perl -w timeout.pl
Version: 0.11
inner timeout
timeout
real 0m3.012s
user 0m0.004s
sys 0m0.008s
# One with Time::HiRes. I still expect the outer timeout to time out, and I don't expect it to take 6+ seconds, just because Time::HiRes is loaded.
Show quoted text> time perl -MTime::HiRes -w timeout.pl
Version: 0.11
inner timeout
normal
real 0m6.021s
user 0m0.012s
sys 0m0.008s
Tested on debian squeeze.