Rudiments

- Main Page
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
signalhandler Class Reference

## Public Member Functions
| signalhandler ()
| ~signalhandler ()
void | setHandler (void(*handler)(int32_t))
bool | handleSignal (int32_t signum)
bool | handleSignal (int32_t signum, signalhandler *oldhandler)
void | removeAllFlags ()
void | addFlag (int32_t flag)
void | removeFlag (int32_t flag)
int32_t | getFlags () const
void | setMask (const signalset *sset)
const signalset * | getMask () const

## Static Public Member Functions
static bool | isSignalHandlerIntUsed ()

## Public Attributes
void(*)(int32_t) | getHandler ()

## Constructor & Destructor Documentation

signalhandler::signalhandler | ( |  | ) |

Creates an instance of the signalhandler class.

signalhandler::~signalhandler | ( |  | ) |

Deletes this instance of the signalhandler class.

## Member Function Documentation

void signalhandler::addFlag | ( | int32_t | flag | ) |

Add "flag" to the set of flags modifying the behavior of this signal handler.

int32_t signalhandler::getFlags | ( |  | ) | const

Return the set of flags modifying the behavior of this signal handler.

const signalset* signalhandler::getMask | ( |  | ) | const

Returns the current signal mask.

bool signalhandler::handleSignal | ( | int32_t | signum | ) |

Instructs the program to handle "signum" by calling the handler set previously in setHandler(). May be called multiple times to associate the same handler with several signals.

Returns true on success and false on failure.

bool signalhandler::handleSignal | ( | int32_t | signum,
|  | signalhandler * | oldhandler
| ) |  |

Instructs the program to handle "signum" by calling the handler set previously in setHandler(). May be called multiple times to associate the same handler with several signals. Populates oldhandler with the values that were used to handle this signal prior to this call.

Returns true on success and false on failure.

static bool signalhandler::isSignalHandlerIntUsed | ( |  | ) |
| static

The function that you pass into setHandler() must have a void (*)(int32_t) signature. However, the native signal handling frameworks on some systems do not allow the signal number to be passed to the handler in the int32_t parameter. As a result, on those platforms, inside the signal handler, the paramer must be ignored.

This method will return true if the platform's native signal handling framework passes anything into the int32_t parameter and false otherwise.

void signalhandler::removeAllFlags | ( |  | ) |

Remove all signal flags.

void signalhandler::removeFlag | ( | int32_t | flag | ) |

Remove "flag" from the set of flags modifying the behavior of this signal handler.

void signalhandler::setHandler | ( | void(*)(int32_t) | handler | ) |

Sets the function to call when the process receives the signal.

void signalhandler::setMask | ( | const signalset * | sset | ) |

Explicitly sets the mask to "sset".

## Member Data Documentation

void(*)(int32_t) signalhandler::getHandler()

Returns a pointer to the function that will be called when the process receives the signal.