4.13. SigSet Class

SigSet class implements a wrapper around POSIX.1 sigset_t structure, providing all manipulators on this structure as well.


class SigSet
    SigSet(sigset_t* source_);

    int empty (void);
    int fill(void);

    int add(int signo_);
    int del(int signo_);

    int is_member(int signo_);
    operator sigset_t *();

4.13.2. USAGE

The Conversion operator that converts SigSet to a pointer to the internal sigset_t data member for direct use with "C" library functions can be used as:

SigSet  source;
sigset_t*  targetp;
targetp = source;

Because lvalue is expected to be sigset_t*, and there is a conversion operator defined for SigSet, the conversion happens automatically.

Another example would be to use it in conjunction with struct sigaction:

void foo ()
    struct sigaction action;
    SigSet signals_to_block;
    // manipulate signal set in some meaningful way
    action.sa_mask = *signals_to_block;