Wouldn't it be simpler to use cron to run your program every hour?
Signals will interrupt sleep if you have a signal handler for them.
my $exit; local $SIG{INT} = local $SIG{TERM} = sub { $exit = 1; }; my $wakeup_time = time + 60*60; for (;;) { if ($exit) { ... exit(0); } my $sleep_dur = $wakeup_time - time; last if $sleep_dur <= 0; sleep($sleep_dur); }
In reply to Re: Waking threads that do periodic checks
by ikegami
in thread Waking threads that do periodic checks
by metafor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |