Open System Services Programmer's Guide

usleep()
wait()
waitpid()
The pthread_kill() function provides a mechanism for synchronously directing a signal
to a thread in the calling process.
Signals sent with the pthread_kill() function are queued in FIFO order for the target
thread. More than one instance of the same signal might be pending for a thread. However,
applications should not rely on this ordering.
A signal is handled in the context of the given thread. However, the signal action (terminating
or stopping) might affect the process as a whole. See “Thread-Aware Signal Handling
(page 388).
You must specify whether a signal listed in Table 68 (page 385) as generating a saveabend
actually generates a saveabend by specifying the -Wsaveabend flag in c89 or c99, or
saveabend in nld, ld, or eld.
If a signal is delivered to a thread waiting on a condition variable, then upon return from the
signal handler, the thread will resume waiting for the condition variable as if it were not
interrupted.
The Protected Thread Stack for Signals
The PUT Model library does not allow you to establish a signal stack using the sigaltstack()
function. Instead, the library allocates a protected signal stack for use by signal handlers and
applications that use the PUT Model library can use the sigaltstack() function to get the status
of the signal stack.
Thread-aware signal handling is enabled by default in the PUT Model library. The library allocates
and installs a protected stack to allow external signals and synchronous signals to be delivered to
a signal stack that is different from the thread stack.
When an external asynchronous signal is delivered to the PUT library signal handler on the
signal stack, the thread library signal handlers check to see if the current thread can handle
the signal. If it can, then the thread library signal handler invokes the thread signal handler
immediately on the same signal stack. If the current thread cannot handle the signal, the thread
library signal handler finds the thread that can and queues the signal for that thread and
return. The thread signal handlers for these queued signals are run either at the thread dispatch
time or at the cancellation point on the main stack for the thread.
When a synchronous signal is delivered to the thread library signal handler on the signal
stack, the signal gets processed immediately. If the current thread can handle the signal, the
thread signal handler gets invoked immediately on the same signal stack; otherwise, the thread
library signal handler performs the default action associated with the signal and terminates
the process.
If nested signals are delivered to the thread library signal handler, they are delivered on the
same signal stack as the signal handler being interrupted. If a nested thread signal handler
is run by the thread library signal handler, it is run on the same signal stack as the thread
signal handler that is being interrupted.
Signals and Signal Handling 387