Open System Services System Calls Reference Manual (G06.28+, H06.05+)
System Functions (s and S) spt_alarm(2)
NAME
spt_alarm - Schedules an alarm signal for delivery to a process (thread-aware version)
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
#include <spthread.h>
unsigned int spt_alarm(
nsigned int *seconds);
PARAMETERS
seconds Specifies the number of real-time seconds to wait before sending the SIGALRM
signal.
DESCRIPTION
The spt_alarm() function instructs the alarm clock of the calling thread to send the signal
SIGALRM to a process after the number of real-time seconds specified by seconds has elapsed.
If the value of seconds is 0 (zero), any previously set alarm is cancelled and no new alarm is
scheduled. Each call to spt_alarm() from a thread supersedes any previous calls from the same
thread. If the same thread calls the spt_alarm() function multiple times, the value of the
seconds parameter from the most recent call is used.
To enable thread-aware behavior for this function, you must export the
SPT_THREAD_AWARE_SIGNAL envronmental variable to the value 1. By default,
SPT_THREAD_AWARE_SIGNAL is disabled. If you do not export
SPT_THREAD_AWARE_SIGNAL to 1, the spt_alarm() function behaves as a process-level
alarm (see the alarm(3) reference page).
In spthread.h, a mapping of alarm( ) to spt_alarm() has been defined:
#define alarm(seconds) spt_alarm(seconds)
For C applications, this mapping is available only when you define the correct preprocessor
before you include spthread.h:
#define SPT_THREAD_SIGNAL
#include <spthread.h>
For C++ applications, this mapping is available only when you define the correct preprocessor
before you include spthread.h:
#define SPT_THREAD_SIGNAL_PRAGMA
#include <spthread.h>
RETURN VALUES
If a previous call to the spt_alarm(2) function has time remaining, this call to the spt_alarm(2)
function returns the number of seconds remaining. Otherwise this function returns a value of 0
(zero).
RELATED INFORMATION
Functions: alarm(3), pthread_kill(2), pthread_sigmask(2), spt_pause(2), spt_sigaction(2),
spt_signal(2), spt_sigsuspend(2), spt_sigwait(2).
527186-007 Hewlett-Packard Company 7−93