sigpause.3c (2010 09)

s
sigpause(3C) sigpause(3C)
NAME
sigpause - signal management
SYNOPSIS
#include <signal.h>
int sigpause(int sig);
Obsolescent
long sigpause(long mask);
DESCRIPTION
The sigpause() function, along with the sighold(),
sigignore(), sigrelse(), and sig-
set() functions provide simplified signal management.
The
sigpause() function removes sig from the calling thread’s signal mask and suspends the calling
thread until a signal is received. The sigpause()
function restores the thread’s signal mask to its ori-
ginal state before returning.
RETURN VALUE
The
sigpause() function suspends execution of the thread until a signal is received, whereupon it
shall return -1 and set errno to [EINTR].
ERRORS
[EINVAL] sig is not a valid signal number.
WARNINGS
The
_XPG4_EXTENDED compiler option must be set to use sigpause() . The use of the function without
the option is unspecified.
sigpause() should not be used in conjunction with signal (2) and sigspace (2).
OBSOLESCENT FUNCTION
sigpause(long) will be obsoleted in the near future. The obsolescent
sigpause() function blocks
signals according to the value of mask, 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.
sigpause() terminates when it is interrupted by a signal. When sigpause() terminates, it returns
−l and sets errno to [EINTR].
The obsolescent
sigpause() function is typically used in conjunction with the obsoleted sigblock()
function.
Threads Considerations
Since blocked signal masks are maintained at the thread level, the obsolescent
sigpause() function
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).
LP64 Programs
This obsolescent sigpause() accepts a long (64 bit) value. However, as for ILP32 programs, sig-
pause() supports signals numbered 1 through 32. The upper 32 bits of the mask argument are ignored.
Author
sigpause(long) was developed by the University of California, Berkeley.
SEE ALSO
kill(1), kill(2), pause(2), signal(2), wait(2), abort(3C), setjmp(3C), sighold(3C), sigignore(3C), sigrelse(3C),
sigset(3C), signal(5).
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1