sigemptyset()--Initialize and Empty Signal Set


  Syntax
 #include <signal.h>

 int sigemptyset( sigset_t *set );   

  Service Program Name: QPOSSRV1

  Default Public Authority: *USE

  Threadsafe: Yes

The sigemptyset() 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()).

sigemptyset() initializes the signal set specified by set to an empty set. That is, all supported signals are excluded (see Control Signals Table).


Authorities and Locks

None.


Parameters

*set
(Input) A pointer to a signal set.

Return Value

0 sigemptyset() was successful.


Error Conditions

The sigemptyset() function does not return an error.


Related Information


Example

See Code disclaimer information for information pertaining to code examples.

The following example initializes a set of signals to the empty set:

#include <stdio.h>
#include <unistd.h>
#include <signal.h>

int main( int argc, char *argv[] ) {

    struct sigaction sigact;
    sigset_t sigset;

    sigemptyset( &sigact.sa_mask );
    sigact.sa_flags = 0;
    sigact.sa_handler = SIG_IGN;
    sigaction( SIGUSR2, &sigact, NULL );

    /*
     * Unblocking all signals ensures that the signal
     * handling action will be taken when the signal
     * is generated.
     */

    sigemptyset( &sigset );
    sigprocmask( SIG_SETMASK, &sigset, NULL );

    printf( "before kill()\n" );
    kill( getpid(), SIGUSR2 );
    printf( "after kill()\n" );

    return( 0 );
}

Output:

    before kill()
    after kill()


API introduced: V3R6
Top | UNIX-Type APIs | APIs by category