OSF DCE Application Development Guide--Introduction and Style Guide
OSF DCE Application Development Guide—Introduction and Style Guide
2.3.4.2 Synchronous Signal Handling
Threads should call sigaction( ) to establish per-thread handlers for synchronous signals.
The DCE Threads sigaction( ) function only modifies the signal action behavior for the
calling thread and only works for synchronous signals. Threads must not use sigaction( )
for asynchronous signals.
Signal handlers should be careful in the actions they perform. In general, synchronous
signal handlers should attempt to clean up and allow the thread to terminate. It is not
advisable to attempt to continue after errors such as a segment violation, illegal
instruction, and the like.
In general, the threads routines cannot safely be called within a signal handler.
Furthermore, runtime libraries cannot reliably be used in signal handlers.
2.3.4.3 Asynchronous Signal Handling
Applications should handle asynchronous signals by having one thread (or possibly a
few specific threads) call sigwait( ). The waited-for signals must be blocked before
waiting. The recommended procedure is to establish a ‘‘signal catcher’’ thread that calls
sigprocmask( ) to establish the per-process mask for asynchronous signals and then calls
sigwait( ) to wait for the set of blocked signals. The following code fragment shows an
example of a signal catcher thread start routine:
2− 16 Tandem Computers Incorporated 124246