#include <UT_Signal.h>
|
| UT_Signal (int signum=0, UToldStyleSigHandler handler=SIG_DFL, bool ignore_prev=false) |
|
| UT_Signal (int signum, UTsigHandler handler, bool ignore_prev=false, void *user_data=nullptr) |
|
| UT_Signal (const Empty &) |
|
template<std::size_t Size> |
| UT_Signal (const int(&signums)[Size], UToldStyleSigHandler handler=SIG_DFL, bool ignore_prev=false) |
|
template<std::size_t Size> |
| UT_Signal (const int(&signums)[Size], UTsigHandler handler, bool ignore_prev=false, void *user_data=nullptr) |
|
| UT_Signal (const UT_Array< int > &signums, UTsigHandler handler, bool ignore_prev=false, void *user_data=nullptr) |
|
| UT_Signal (const UT_Array< int > &signums, UToldStyleSigHandler handler=SIG_DFL, bool ignore_prev=false) |
|
| ~UT_Signal () |
| Destructing will restore the signals to their previous values. More...
|
|
| UT_Signal (const UT_Signal &)=delete |
|
UT_Signal & | operator= (const UT_Signal &)=delete |
|
void | override (int signum, UToldStyleSigHandler, bool ignore_prev=false) |
|
void | override (int signum, UTsigHandler, bool ignore_prev=false, void *user_data=nullptr) |
|
void | removeSignal (int sig) |
| Remove a specific signal. More...
|
|
Definition at line 171 of file UT_Signal.h.
Catch a specified signal. If signum <= 0, then all signals (except ABRT) are caught. There are two styles of constructors. One takes an old-style signal handler that is needed so we can easily specify SIG_DFL, SIG_IGN, and SIG_ERR as the signal behaviours. The other constructor takes our own data structure as an argument and is designed to support the SA_SIGINFO 3-argument style callback added in POSIX.1b. If ignore_prev is false, all other signal handlers for the raised signal will be called in the reverse order they were installed. Otherwise, only the last handler for this signal will be called.
UT_Signal::UT_Signal |
( |
int |
signum, |
|
|
UTsigHandler |
handler, |
|
|
bool |
ignore_prev = false , |
|
|
void * |
user_data = nullptr |
|
) |
| |
|
explicit |
UT_Signal::UT_Signal |
( |
const Empty & |
| ) |
|
|
explicit |
This constructor is used when the signals that we want to catch are unknown at the time the signal object is created.
template<std::size_t Size>
UT_Signal::UT_Signal |
( |
const int(&) |
signums[Size], |
|
|
UToldStyleSigHandler |
handler = SIG_DFL , |
|
|
bool |
ignore_prev = false |
|
) |
| |
|
inline |
Catch a specified set of signals. The first argument is an array of signal numbers to catch. The array should be null terminated (since there is no signal 0)
Definition at line 201 of file UT_Signal.h.
template<std::size_t Size>
UT_Signal::UT_Signal |
( |
const int(&) |
signums[Size], |
|
|
UTsigHandler |
handler, |
|
|
bool |
ignore_prev = false , |
|
|
void * |
user_data = nullptr |
|
) |
| |
|
inline |
UT_Signal::~UT_Signal |
( |
| ) |
|
Destructing will restore the signals to their previous values.
static void UT_Signal::disableCantReturn |
( |
bool |
disable | ) |
|
|
static |
This disables the cant return behaviour used in UT_Signal. This behaviour will abort the application on behalf of the application itself for signals that it treats as cant return (i.e. SIGTERM). For some applications the application needs to control the full shutdown otherwise the application can end up erroring on exit.
The following method is made available to override the default handler without destructing the object. For example, in the signal handler, you may want to ignore further signals of a certain type. This method allows you to set the signals. In fact, it simply calls sigaction() with the new handler.
void UT_Signal::removeSignal |
( |
int |
sig | ) |
|
Remove a specific signal.
The documentation for this class was generated from the following file: