Go to the first, previous, next, last section, table of contents.


sigpending

Syntax

#include <signal.h>

int sigpending (sigset_t *set)

Description

This function retrieves the signals that have been sent to the program, but are being blocked from delivery by the program's signal mask (see section sigprocmask). The bit-mapped value which describes the pending signals is stored in the structure pointed to by set. You can use the sigismember function (see section sigismember) to see what individual signals are pending.

Return Value

0 on success, -1 on failure (and errno set to EFAULT).

Portability

not ANSI, POSIX

Example

#include <signal.h>

  sigset_t pending_signals;

  /* If SIGINT is pending, force it to be raised.  */
  if (sigpending (&pending_signals) == 0
      && sigismember (&pending_signals, SIGINT))
    {
      sigset_t new_set, old_set;
      sigemptyset (&new_set);
      sigaddset (&new_set, SIGINT);
      sigprocmask (SIG_UNBLOCK, &new_set, &old_set);  /* will raise SIGINT */
      sigprocmask (SIG_SETMASK, &old_set, &new_set);  /* restore mask */
    }


Go to the first, previous, next, last section, table of contents.