|
|
HP-UX Reference Volume 4 of 5 > ssigpause(3C) |
|
NAMEsigpause — atomically release blocked signals and wait for interrupt DESCRIPTIONsigpause() blocks signals according to the value of mask in the same manner as sigsetmask(2), then atomically waits for an unmasked signal to arrive. On return, sigpause() restores the current signal mask to the value that existed before the sigpause() call. When no signals are to be blocked, a value of 0L is used for mask. In normal usage, a signal is blocked using sigblock() (see sigblock(2)). To begin a critical section, variables modified on the occurrence of the signal are examined to determine that there is no work to be done, and the process pauses, awaiting work by using sigpause() with the mask returned by sigblock(). RETURN VALUEsigpause() terminates when it is interrupted by a signal. When sigpause() terminates, it returns -l and sets errno to EINTR. EXAMPLESThe following call to sigpause() waits until the calling process receives a signal: sigpause (0L); The following example blocks the SIGIO signal until sigpause() is called. When a signal is received at the sigpause() statement, the signal mask is restored to its value before sigpause() was called: long savemask; savemask = sigblock (sigmask (SIGIO)); /* critical section */ sigpause (savemask); WARNINGSCheck all references to signal(5) for appropriateness on systems that support sigvector(2). sigvector() can affect the behavior described on this page. Do not use sigpause() in conjunction with the facilities described under sigset(3C). APPLICATION USAGEThreads ConsiderationsSince blocked signal masks are maintained at the thread level, sigpause() modifies only the calling thread's blocked signal mask. sigpause() suspends only the calling thread until it receives a signal. If other threads in the process do not block the signal, the signal may be delivered to another thread in the process and the thread in sigpause() may continue waiting. For this reason, the use of sigwait(2) is recommended instead of sigpause() for multi-threaded applications. For more information regarding signals and threads, refer to signal(5). |
|