Open System Services System Calls Reference Manual (G06.28+, H06.05+)
spt_signal(2) OSS System Calls Reference Manual
NAME
spt_signal - Installs a new signal handler
LIBRARY
G-series native OSS processes: /G/system/sysnn/zsptsrl
H-series OSS processes: /G/system/zdllnnn/zsptdll
SYNOPSIS
#include <spthread.h>
void * spt_signal(int sig, void (* *Vhandler)(int))
PARAMETERS
sig Specifies the signal number.
handler User-specified signal function that acts a signal handler.
DESCRIPTION
The spt_signal() function allows the calling thread to change the action to be taken when a
specific signal is delivered to the thread calling this function.
To catch externally generated signals (such as SIGINT, SIGQUIT, SIGALRM, and SIGCHLD) at
the thread level, you must export the SPT_THREAD_AWARE_SIGNAL envronmental variable
to the value 1. By default, SPT_THREAD_AWARE_SIGNAL is disabled. If you export
SPT_THREAD_AWARE_SIGNAL to 1, the signal handler registered for that thread will be exe-
cuted immediately within the scope of the internal generic handler for pthreads. However, the
thread itself executes only when it is scheduled. Consequently, you cannot use thread-specific
functions like pthread_self() inside thread-specific signal handler functions.
Every signal has an associated default action. The spt_signal() function can change this action
by specifying that the receiving thread:
— Ignore the delivery of a specific signal.
— Restore the default action for a specific signal.
— Invoke a signal-catching function in response to the delivery of a
specific signal.
If you use the spt_signal() function to invoke a signal-catching function, the
action associated with the signal is restored to the default action each time the
signal is delivered. This behavior is different from the behavior of the
spt_sigaction() function, which does not restore the default signal action after
execution.
In spthread.h, a mapping of signal() to spt_signal() has been defined:
#define signal(sig_handler) spt_signal((sig),(handler))
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>
7−316 Hewlett-Packard Company 527186-007