[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions , Volume 2

sigsuspend or sigpause Subroutine


Automatically changes the set of blocked signals and waits for a signal.


Standard C Library (libc.a)


#include <signal.h>

int sigsuspend ( SignalMask)
const sigset_t *SignalMask;

int sigpause (SignalMask)
int SignalMask;


The sigsuspend subroutine replaces the signal mask of a thread with the set of signals pointed to by the SignalMask parameter. It then suspends execution of the thread until a signal is delivered that executes a signal-catching function or terminates the process. The sigsuspend subroutine does not allow the SIGKILL or SIGSTOP signal to be blocked. If a program attempts to block one of these signals, the sigsuspend subroutine gives no indication of the error.

If delivery of a signal causes the process to end, the sigsuspend subroutine does not return. If delivery of a signal causes a signal-catching function to start, the sigsuspend subroutine returns after the signal-catching function returns, with the signal mask restored to the set that existed prior to the sigsuspend subroutine.

The sigsuspend subroutine sets the signal mask and waits for an unblocked signal as one atomic operation. This means that signals cannot occur between the operations of setting the mask and waiting for a signal. If a program invokes the sigprocmask (SIG_SETMASK) and pause subroutines separately, a signal that occurs between these subroutines might not be noticed by the pause subroutine.

In normal usage, a signal is blocked by using the sigprocmask(SIG_BLOCK,...) subroutine for single-threaded applications, or the sigthreadmask(SIG_BLOCK,...) subroutine for multi-threaded applications (using the libpthreads.a threads library) at the beginning of a critical section. The process/thread then determines whether there is work for it to do. If no work is to be done, the process/thread waits for work by calling the sigsuspend subroutine with the mask previously returned by the sigprocmask or sigthreadmask subroutine.


SignalMask Points to a set of signals.

Return Values

If a signal is caught by the calling thread and control is returned from the signal handler, the calling thread resumes execution after the sigsuspend or sigpause subroutine, which always return a value of -1 and set the errno global variable to EINTR.

Implementation Specifics

These subroutines are part of Base Operating System (BOS) Runtime.

The sigpause subroutine is provided for compatibility with older UNIX systems; its function is a subset of the sigsuspend subroutine.

Related Information

The pause subroutine, sigprocmask (sigprocmask, sigsetmask, or sigblock Subroutine) subroutine, sigaction or signal (sigaction, sigvec, or signal Subroutine) subroutine, sigthreadmask (sigthreadmask Subroutine) subroutine.

Signal Management in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs provides more information about signal management in multi-threaded processes.

[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]