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

I also use Linux. And I forgot about automatical alarm restart feature... I've readed something about this in Stevens'APUE but this was many time ago and I don't have this book now. Can anybody remind me in which cases/OS alarm can be automatically restarted?

BTW, in the Russian edition of TPC, the alarm interval is set for 10 seconds too. It's just me too impatient to copy example for book as-is. :)

Replies are listed 'Best First'.
Re^3: second alarm(0)
by tlm (Prior) on Apr 30, 2005 at 16:06 UTC

    I never heard about an automatic resetting of the alarm interval. I know about a different automatic behavior: Perl will automatically resume some system calls after receiving an ALRM signal; that's why the SIG{ ALRM } handler has to explicitly die. For example, this one-liner hangs:

    % perl -le '$|=1; $SIG{ALRM} = sub { print q(Goosed!) }; alarm 2; eval + { <> }; print q(done)'
    because after the ALRM perl goes back to waiting for input. The one-liner also illustrates that the alarm interval is not automatically reset after the program receives an ALRM signal, since the $SIG{ ALRM } handler is called only once.

    the lowliest monk