alarm(2) SDK R4.11 alarm(2)
NAME
alarm - set a process alarm clock
SYNOPSIS
#include <unistd.h>
unsigned int alarm (sec)
unsigned int sec;
where:
sec The number of real-time seconds to wait before sending
SIGALRM to the caller
DESCRIPTION
Alarm sets the caller's per-process real-time alarm clock to send the
signal SIGALRM to the calling process after the number of real-time
seconds specified by sec have elapsed. Alarm requests are not
stacked; successive calls reset the calling process's alarm clock.
If sec is 0, any previous alarm request is canceled. Alarm(2) uses
the same ITIMER_REAL interval timer that setitimer(2) uses. Fork(2)
resets the alarm clock in the child to 0. A process created by
exec(2) inherits the time left on the old process's alarm clock.
As with any signal, a process must enter the kernel in order to take
delivery of the SIGALRM. Thus, if a process sets an alarm and then
continues to run in user space, the delivery of the alarm signal will
be delayed until the process is forced to reenter the kernel. A
process will enter the kernel if (1) its timeslice runs out (2) it is
preempted by a higher priority process (3) it takes an exception, or
(4) the processor on which it is running receives a hardware
interrupt.
RETURN VALUE
Alarm returns the amount of time remaining on the process's alarm
clock from a previous call. If zero, no previous alarm was set.
DIAGNOSTICS
None.
SEE ALSO
getitimer(2), pause(2), setitimer(2), signal(2), sigpause(2),
sigset(2).
Licensed material--property of copyright holder(s)