in reply to Re: Waiting for Alarm
in thread Waiting for Alarm
#!/usr/bin/perl
use Time::HiRes qw ( setitimer ITIMER_REAL time );
my $count;
$SIG{ALRM} = sub { print time, "\n" };
setitimer(ITIMER_REAL, 1, 1);
while (1) {
sleep 1;
}
and it worked fine. If this is reliable, it does the job for me. But I wonder why the first time it only worked for the first iteration...
Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Waiting for Alarm
by n8ur (Acolyte) on Feb 16, 2008 at 18:23 UTC |