Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
spt_alarm(2) OSS System Calls Reference Manual
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 and J 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 environmental 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>
NOTES
To use this function in a threaded application that uses the Standard POSIX Threads library on
systems running J06.10 or later RVUs or H06.21 or later RVUs, you must perform all of the fol-
lowing tasks:
• Include the spthread.h header file in the application.
• Compile the application using the _SPT_MODEL_ feature test macro or equivalent
compiler command option in addition to any other feature test macros in use.
• Link the application to the zsptdll library (/G/system/zdllnnn/zsptdll).
7−134 Hewlett-Packard Company 527186-023