HP-UX SNAplus2 MS Programmer's Guide

Writing MS Applications
Scheduling Asynchronous Events
Chapter 244
Asynchronous verbs are implemented by making callbacks to the
application from signal catcher context. The disadvantages of
signal-based scheduling mode are:
Applications that receive work from multiple sources are difficult to
write
Applications are required to use HP-UX V.3 signal calls
Applications can use only a subset of system calls made from signal
catcher context and therefore from the API callback context
Signaling mode is not thread-safe
Use of Signals To detect work arriving from other components of
SNAplus2, the MS library makes use of the SIGPOLL signal.
Applications can require the SIGPOLL signal for other purposes.
Therefore, the library daisy-chains to any existing signal catchers. The
first verb issued by the application initializes the library's signal catcher.
When the SIGPOLL signal arrives, either it indicates work for SNAplus2
or it was generated for some other reason. The MS library's signal
catcher processes the signal and then calls the next signal catcher to
allow the signal to be used for other purposes.
The following restrictions apply to SIGPOLL usage:
Applications must not permanently disable this signal. The sighold
and sigrelse signal calls can be used to protect a critical region of
code, provided that no SNA verbs are issued between sighold and
sigrelse.
Applications must preserve the address of the SNAplus2 signal
catchers returned by the sigset call when adding signal catchers to
applications. Applications must then arrange to call these routines
from within the new signal catchers.
Applications must not use the POSIX signal mechanism SIGACTN,
which can cause problems in SNAplus2 applications.
The HP-UX operating system call sleep can cause problems if
applications or their libraries also use signal catchers. Because the
SNAplus2 MS library operates using a signal catcher, do not use the
sleep call within an MS application that uses signal-based
scheduling. If necessary, you can use the alarm with a timer to
provide the same function.