http://qs321.pair.com?node_id=11111636


in reply to Signal to a sleeping Perl program

Handled signals causes blocking system calls to be interrupted (so the signal can be handled). You need to handle those errors.

sub uninterruptible_sleep { my $sleep_until = time() + $_[0]; while (1) { my $time_left = $sleep_until - time(); return if $time_left <= 0; sleep($time_left); } }