Additional Topics > External Development Guide > IDLInternals - UNIX Signals > UNIX Signal Masks

# UNIX Signal Masks

UNIX processes contain a signal mask that defines which signals can be delivered and which are blocked from delivery at any given time. When a signal arrives, the UNIX kernel checks the signal mask: If the signal is in the process mask, it is delivered, otherwise it is noted as undeliverable and nothing further is done until the signal mask changes. Sets of signals are represented within IDL with the opaque type IDL_SignalSet_t. UNIX IDL provides several functions that manipulate signal sets to change the process mask and allow/disallow delivery of signals.

## IDL_SignalSetInit()

IDL_SignalSetInit() initializes a signal set to be empty, and optionally sets it to contain one signal.

void IDL_SignalSetInit(IDL_SignalSet_t *set, int signo)

where:

### set

The signal set to be emptied/initialized.

### signo

If non-zero, a signal to be added to the new set. This is provided as a convenience for the large number of cases where a set contains only one signal. Use IDL_SignalSetAdd() to add additional signals to a set.

## IDL_SignalSetAdd()

IDL_SignalSetAdd() adds the specified signal to the specified signal set:

void IDL_SignalSetAdd(IDL_SignalSet_t *set, int signo)

where:

### set

The signal set to be added to. The signal set must have been initialized by IDL_SignalSetInit().

### signo

The signal to be added to the signal set.

## IDL_SignalSetDel()

IDL_SignalSetDel() deletes the specified signal from a signal set:

void IDL_SignalSetDel(IDL_SignalSet_t *set, int signo)

where:

### set

The signal set to delete from. The signal set must have been initialized by IDL_SignalSetInit().

### signo

The signal to be removed from the signal set.

## IDL_SignalSetIsMember()

IDL_SignalSetIsMember() tests a signal set for the presence of a specified signal, returning TRUE if the signal is present and FALSE otherwise:

int IDL_SignalSetIsMember(IDL_SignalSet_t *set, int signo)

where:

### set

The signal set to test. The signal set must have been initialized by IDL_SignalSetInit().

### signo

The signal to be removed from the signal set.

## IDL_SignalMaskGet()

IDL_SignalMaskGet() sets a signal set to contain the signals from the current process signal mask:

void IDL_SignalMaskGet(IDL_SignalSet_t *set)

where:

### set

The signal set in which the current process signal mask will be stored.

## IDL_SignalMaskSet()

IDL_SignalMaskSet() sets the current process signal mask to contain the signals specified in a signal mask:

void IDL_SignalMaskSet(IDL_SignalSet_t *set, IDL_SignalSet_t *omask)

where:

### set

The signal set from which the current process signal mask will be set.

### omask

If `omask` is non-NULL, the unmodified process signal mask is stored in it. This is useful for restoring the mask later using IDL_SignalMaskSet().

There are some signals that cannot be blocked. This limitation is silently enforced by the operating system.

## IDL_SignalMaskBlock()

IDL_SignalMaskBlock() adds signals to the current process signal mask:

void IDL_SignalMaskBlock(IDL_SignalSet_t *set, IDL_SignalSet_t *oset)

where:

### set

The signal set containing the signals that will be added to the current process signal mask.

### oset

If `oset` is non-NULL, the unmodified process signal mask is stored in it. This is useful for restoring the mask later using IDL_SignalMaskSet().

Note: There are some signals that cannot be blocked. This limitation is silently enforced by the operating system.

## IDL_SignalBlock()

IDL_SignalBlock() does the same thing as IDL_SignalMaskBlock() except it accepts a single signal number instead of requiring a mask to be built:

void IDL_SignalBlock(int signo, IDL_SignalSet_t *oset)

where:

### signo

The signal to be blocked.

Note: There are some signals that cannot be blocked. This limitation is silently enforced by the operating system.

## IDL_SignalSuspend()

IDL_SignalSuspend() replaces the process signal mask with the ones in set and then suspends the process until a signal is delivered. On return, the original process signal mask is restored:

void IDL_SignalSuspend(IDL_SignalSet_t *set)

where:

### set

The signal set containing the signals that will be added to the current process signal mask.