NAME
alarm, ualarm - Sets or changes the timeout of interval
timers
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <unistd.h>
unsigned int alarm(
unsigned int seconds) ;
unsigned int ualarm(
unsigned int mseconds,
unsigned int interval) ;
PARAMETERS
seconds Specifies a number of real-time seconds.
mseconds Specifies a number of real-time microseconds.
interval Specifies the interval for repeating the timer.
DESCRIPTION
The alarm() function is used to obtain notification of a
timeout after the number of real-time seconds specified by
the seconds parameter has elapsed. At some time after
seconds seconds have elapsed, a signal is delivered to the
process. The call sends a SIGALRM signal to the calling
process. Each call resets the timer until the seconds
parameter is set to 0 (zero). When the notification signal
is caught or ignored, no action takes place; otherwise the
calling process is terminated. The alarm() function uses
the ITIMER_REAL interval timer.
The ualarm() function is used to obtain notification of a
timeout after the number of real-time microseconds specified
by the mseconds parameter has elapsed. When the interval
parameter is nonzero, timeout notification occurs after the
number of microseconds specified by the interval parameter
has been added to the mseconds parameter. When the notifi-
cation signal is caught or ingnored, no action takes place;
otherwise the calling process is terminated. The ualarm()
function is the simplified interface to the setitimer()
function, and uses the ITIMER_REAL interval timer.
NOTES
The alarm() function is supported for multi-threaded appli-
cations. The ualarm() function is not supported for multi-
ple threads.
Although the alarm() function itself is reentrant, it should
be noted that just as the second of two calls from a single
thread to alarm() resets the timer, this is also true if two
calls are made from different threads.
AES Support Level:
Full use
RETURN VALUES
Upon successful completion, the number of seconds remaining
from the previous alarm() call is returned. Otherwise, -1
is returned and errno is set to indicate the error.
ERRORS
If the alarm() function fails, errno may be set to the fol-
lowing value:
[EINVAL] The seconds parameter specifies a negative value
or a value greater than 100,000,000.
RELATED INFORMATION
Functions: gettimer(3)
Acknowledgement and Disclaimer