delorie.com/djgpp/doc/libc/libc_725.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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

ANSI/ISO C No
POSIX 1003.2-1992; 1003.1-2001

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);

      /* This sigprocmask() call will raise SIGINT. */
      sigprocmask (SIG_UNBLOCK, &new_set, &old_set);

      /* Restore mask */
      sigprocmask (SIG_SETMASK, &old_set, &new_set);
    }


  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004