#include <signal.h> int sigdelset( sigset_t *set, int signo );
The sigdelset() function is part of a family of functions that manipulate signal sets. Signal sets are data objects that let a thread keep track of groups of signals. For example, a thread might create a signal set to record which signals it is blocking, and another signal set to record which signals are pending. Signal sets are used to manipulate groups of signals used by other functions (such as sigprocmask()) or to examine signal sets returned by other functions (such as sigpending()).
sigdelset() removes the specified signo from the list of signals recorded in set.
None.
0 | sigdelset() successfully deleted from the signal set. |
-1 | sigdelset() was not successful. The errno variable is set to indicate the error. |
If sigdelset() is not successful, errno usually indicates the following error. Under some conditions, errno could indicate an error other than that listed here.
The value specified for the argument is not correct.
A function was passed incorrect argument values, or an operation was attempted on an object and the operation specified is not supported for that type of object.
An argument value is not valid, out of range, or NULL.
The value of signo is not within the range of valid signals or specifies a signal that is not supported.
See Code disclaimer information for information pertaining to code examples.
The following example deletes a signal from a set of signals:
#include <stdio.h> #include <unistd.h> #include <signal.h> void catcher( int sig ) { printf( "catcher() has gained control\n" ); } int main( int argc, char *argv[] ) { struct sigaction sigact; sigset_t sigset; sigemptyset( &sigact.sa_mask ); sigact.sa_flags = 0; sigact.sa_handler = catcher; sigaction( SIGUSR1, &sigact, NULL ); /* * Blocking all signals prevents the blockable * signals from being delivered until they are * unblocked, so the catcher will not gain * control. */ sigfillset( &sigset ); sigaddset( &sigset, SIGUSR1 ); sigprocmask( SIG_SETMASK, &,sigset, NULL ); printf( "before kill()\n" ); kill( getpid(), SIGUSR1 ); printf( "before unblocking SIGUSR1\n" ); sigdelset( &sigset, SIGUSR1 ); sigprocmask( SIG_SETMASK, &sigset, NULL ); printf( "after unblocking SIGUSR1\n" ); return( 0 ); }
before kill() before unblocking SIGUSR1 catcher() has gained control after unblocking SIGUSR1
Top | UNIX-Type APIs | APIs by category |