in reply to Re: second alarm(0)
in thread second alarm(0)

And there another question... If you right about restarting alarm, then proposed second alarm(0) don't fix race condition but make it much more tiny... but size, as mentioned in TPC, doesn't matter when we speak about race conditions. :)
eval { local $SIG{ALRM} = sub {die "alarm here"}; alarm(5); eval { long_code(); }; # HERE COME FIRST SIGALRM alarm(0); die if $@; # propagate error } # HERE COME SECOND SIGALRM alarm(0); die if $@ && $@ !~ /alarm here/;
On server under high load and alarm(1) instead of alarm(5) there is nothing unusual in my scenario. And second SIGALRM will trigger default handler resulting in killing current process.