Open System Services Programmer's Guide

Thread-Aware Signal Handling APIs
These APIs are supported for J-series RVUs, H06.06 and later H-series RVUs, and G06.29 and
later G-series RVUs:
DescriptionAPI
Allows the calling thread to change the action to be taken when a specific signal is
delivered to the thread issuing this function call. To enable thread-aware signal handling,
spt_signal()
export the SPT_THREAD_AWARE_SIGNAL environmental variable from within the shell
to the value 1. If thread-aware signal handling is not enabled, signals are handled at
the process level.
For C applications, an application call to signal() is automatically mapped to
spt_signal() when you compile the application using the
#define _SPT_THREAD_SIGNAL feature test macro or an equivalent compiler
command option.
For C++ applications, an application call to signal() is automatically mapped to
spt_signal() when you compile the application using the
#define _SPT_THREAD_SIGNAL_PRAGMA feature test macro or an equivalent compiler
command option.
Arranges for a SIGALRM signal to be delivered to the process from a thread in the
specified number of seconds. To enable thread-aware signal handling, export the
spt_alarm()
SPT_THREAD_AWARE_SIGNAL environmental variable from within the shell to the
value 1. If thread-aware signal handling is not enabled, alarms are handled at the process
level.
For C applications, an application call to alarm() is automatically mapped to
spt_alarm() when you compile the application using the
#define _SPT_THREAD_SIGNAL feature test macro or an equivalent compiler
command option.
For C++ applications, an application call to alarm() is automatically mapped to
spt_alarm() when you compile the application using the
#define _SPT_THREAD_SIGNAL_PRAGMA feature test macro or an equivalent compiler
command option.
Limitations
Do not deliver signals like SIGALRM and SIGCHLD using the kill command or the raise()
function because these functions do not provide enough information about the process IDs for the
parent and child processes. Instead, use the spt_alarm() function to raise alarms.
Examples
Example 63 (page 320) provides an example of handling the synchronous signal SIGFPE.
The output of Example 63 (page 320) depends on whether thread-aware signal handling is enabled:
If thread-aware signal handling not enabled, the signal handler defined in the example,
sighand, is not executed, and signal 31 (SIGABEND) is delivered to the process.
If thread-aware signal handling is enabled, the signal handler defined in the example is
executed, and signal 8 (SIGFPE) is received by the thread. On successful return from a
signal-catching function for a SIGFPE, SIGILL, SIGLIMIT,SIGMEMERR, SIGMEMMGR,
SIGNOMEM, SIGSEGV, or SIGSTK signal that was not generated by a kill() or raise()
function call, a process receives a SIGABEND signal and terminates.
4. The SIGPIPE and SIGURG signals are synchronous for H06.20 and earlier H-series RVUs and J06.09 and earlier J-series
RVUs, and asynchronous for H06.21 and later H-series RVUs and J06.10 and later J-series RVUs.
Standard POSIX Threads 319