Rudiments
|
Inherits object.
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 () |
void | setMask (signalset *sset) |
const signalset * | getMask () |
Public Member Functions inherited from object | |
virtual | ~object () |
Static Public Member Functions | |
static bool | supportsSignalHandlerParameter () |
Public Attributes | |
void(*)(int32_t) | getHandler () |
The signalhandler class provides methods for catching and handling signals.
signalhandler::signalhandler | ( | ) |
Creates an instance of the signalhandler class.
signalhandler::~signalhandler | ( | ) |
Deletes this instance of the signalhandler class.
void signalhandler::addFlag | ( | int32_t | flag | ) |
Add "flag" to the set of flags modifying the behavior of this signal handler.
int32_t signalhandler::getFlags | ( | ) |
Returns the set of flags modifying the behavior of this signal handler.
const signalset* signalhandler::getMask | ( | ) |
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.
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 | ( | signalset * | sset | ) |
Explicitly sets the mask to "sset".
|
static |
The function that you pass into setHandler() must have a void (*)(int32_t) signature.
However, on some platforms, the native signal handling frameworks do not actually pass the signal into the signal handler in this parameter. As a result, on those platforms, inside the signal handler, the parameter will have an undefined value and must be ignored.
This method will return true if the platform's native signal handling framework passes anything into the parameter and false otherwise.
void(*)(int32_t) signalhandler::getHandler() |
Returns a pointer to the function that will be called when the process receives the signal.