return undef;
}
},
+ 'select' => sub {
+ if ($Config::Config{d_select}) {
+ diag 'Using select()-based fallback usleep()';
+ return sub {
+ my $s = $_[0];
+ my $r = 0;
+ while ($s > 0) {
+ my ($found, $t) = select(undef, undef, undef, $s / 1e6);
+ last unless defined $t;
+ $t = int($t * 1e6);
+ $s -= $t;
+ $r += $t;
+ }
+ return $r;
+ };
+ } else {
+ return undef;
+ }
+ },
'sleep' => sub {
diag 'Using sleep()-based fallback usleep()';
return sub {
},
);
- @impls = qw<Time::HiRes sleep> unless @impls;
+ @impls = qw<Time::HiRes select sleep> unless @impls;
my $usleep;
for my $impl (@impls) {
use Test::More;
-my @impls = qw<Time::HiRes sleep>;
+my @impls = qw<Time::HiRes select sleep>;
for my $impl (@impls) {
my $desc = "$impl-based usleep()";