in reply to Why is SIGCHLD affecting sleep?
From sleep,
May be interrupted if the process receives a signal
You could just go to sleep repeatedly until it's time.
# Optional, but a good idea with short durations. use Time::HiRes qw( sleep time ); sub uninterrupted_sleep { my ($duration) = @_; die if !$duration; my $sleep_till = time() + $duration; while ($duration > 0) { sleep($duration); $duration = $sleep_till - time(); } }
Update: Bug fix. Changed $duration -= to $duration =.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Why is SIGCHLD affecting sleep?
by jsoverson (Novice) on Aug 09, 2007 at 22:41 UTC |