Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

alarm(3) OSS Library Calls Reference Manual
NAME
alarm - Sets or changes the timeout value for interval timers
LIBRARY
G-series native Guardian processes: system library
G-series native OSS processes: system library
H-series and J-series native Guardian processes: implicit libraries
H-series and J-series OSS processes: implicit libraries
32-bit H-series and J-series OSS processes that use the POSIX User Thread Model library: |
/G/system/zdllnnn/zputdll
64-bit H-series and J-series OSS processes that use the POSIX User Thread Model library: |
/G/system/zdllnnn/yputdll
SYNOPSIS
#include <unistd.h>
unsigned int alarm(
unsigned int seconds);
PARAMETERS
seconds Specifies the number of real-time seconds before the timer expires. Any value
greater than the system maximum of 0x7FFFFFFF one-hundredths of a second
is reduced to the system maximum without informing the caller.
DESCRIPTION
The alarm( ) function is used to obtain notification of a timeout after the number of real-time
seconds specified by the seconds parameter have elapsed.
When the number of seconds specified by the seconds parameter have elapsed, a SIGALRM sig-
nal is sent to the process. The receipt of this signal might be delayed because of scheduling
conflicts.
Each call to alarm( ) overrides any previous setting. Calling alarm( ) with the value 0 (zero) in
the seconds parameter cancels the timer.
Use From a Threaded Application
The thread-aware alarm( ) function instructs the alarm clock of the calling thread to send a
SIGALRM signal to the process after the number of real-time seconds specified by the seconds
parameter have elapsed. If the value of seconds parameter is 0 (zero), any previously set alarm is
cancelled and no new alarm is scheduled. Each call to the alarm( ) function from a thread super-
cedes any previous calls from the same thread. If the same thread calls the alarm( ) function
multiple times, the value of the seconds parameter from the most recent call is used.
The thread-aware behavior for this function is always enabled in the POSIX User Thread (PUT)
library.
Use From the Guardian Environment
The actions of this function are undefined if it is called from a TNS or accelerated Guardian pro-
cess or from any privileged process.
NOTES
To use the alarm( ) functionality in a threaded application that uses the Standard POSIX Threads
library, see spt_alarm(2).
To use this function in a threaded application that uses the POSIX User Thread Model library on
systems running H06.21 or later RVUs or J06.10 or later RVUs, you must perform all of the fol-
lowing tasks to make the function thread-aware in a multi-threaded application:
Compile the application using the _PUT_MODEL_ feature test macro or equivalent
compiler command option.
118 Hewlett-Packard Company 527187-017