OSF DCE Application Development Guide--Core Components

Programming with Threads
Asynchronous, terminating signals represent an occurrence of an event that is external to
the process and, if unhandled, results in the termination of the process. When an
asynchronous terminating signal is delivered, DCE Threads catches it and checks to see
if any threads are waiting for it. If threads are waiting, they are awakened, and the signal
is considered handled and is dismissed. If there are no waiting threads, then DCE
Threads causes the process to be terminated as if the signal had not been handled.
8.2.2 DCE Threads Signal Handling
DCE Threads provides the POSIX sigwait( ) service to allow threads to perform
activities similar to signal handling without having to deal with signals directly. It also
provides a jacket for sigaction( ) that allows each thread to have its own handler for
synchronous signals.
In order to provide these mechanisms, DCE Threads installs signal handlers for most of
the UNIX signals during initialization.
DCE Threads do not provide handlers for several UNIX signals. Those signals and the
reasons why handlers are not provided are shown in Table 8-1.
TABLE 8-1. Signals for Which Handlers Are Not Provided
_______________________________________________________
Signal Reason Handler Is Not Provided
_______________________________________________________
_______________________________________________________
These signals cannot be caught by
user mode code.
SIGKILL and SIGSTOP
_______________________________________________________
Catching this signal interferes with
debugging.
SIGTRAP
_______________________________________________________
These signals are caught only
while a thread has issued a
sigwait() call because their default
actions are otherwise valuable.
SIGTSTP and SIGQUIT
_______________________________________________________
8.2.2.1 The POSIX sigwait( ) Service
The DCE Threads implementation of the POSIX sigwait() service allows any thread to
block until one of a specified set of signals is delivered. A thread waits for any of the
asynchronous signals, except for SIGKILL and SIGSTOP.
A thread cannot wait for a synchronous signal. This is because synchronous signals are
the result of an error during the execution of a thread; if the thread is waiting for a signal,
then it is not executing. Therefore, a synchronous signal cannot occur for a particular
thread while it is waiting, and so the thread waits forever. POSIX stipulates that the
thread must block the signals (using the UNIX system service sigprocmask()) it waits
for before calling sigwait().
124245 Tandem Computers Incorporated 87