5 Signal Processing
5 Signal Processing
#include <signal.h>
int sigpending(sigset_t * set);
#include <unistd.h>
int pause(void);
pause() does not return until after a signal
has been delivered to the process.
If a signal handler is present for that signal,
the signal handler is run before pause()
returns.
pause() always returns -1 and sets errno to
EINTR .
#include <signal.h>
int sigsuspend(const sigset_t * mask);
Like pause(), sigsuspend() suspends the process until a
signal has been received (and processed by a signal
handler, if one is available), returning -1 and setting
errno to EINTR .
Unlike pause(), sigsuspend() temporarily sets the
process's signal mask to the value pointed to by the
mask parameter before waiting for a signal to occur.
Once the signal occurs, the signal mask is restored to
the value it had before sigsuspend() was called.
This allows a process to wait for a particular signal to
occur by blocking all other signals.