E-MailRelay
|
A static interface for registering cleanup functions that are called when the process terminates abnormally. More...
#include <gcleanup.h>
Classes | |
struct | Block |
A RAII class to temporarily block signal delivery. More... | |
Static Public Member Functions | |
static void | init () |
An optional early-initialisation function. May be called more than once. More... | |
static void | add (bool(*fn)(SignalSafe, const char *), const char *arg) |
Adds the given handler to the list of handlers that are to be called when the process terminates abnormally. More... | |
static void | atexit (bool active=true) |
Ensures that the cleanup functions are also called via atexit(), in addition to abnormal-termination signals. More... | |
static void | block () noexcept |
Temporarily blocks signals until release()d. More... | |
static void | release () noexcept |
Releases block()ed signals. More... | |
static const char * | strdup (const char *) |
A strdup() function that makes it clear in the stack trace that leaks are expected. More... | |
static const char * | strdup (const std::string &) |
A strdup() function that makes it clear in the stack trace that leaks are expected. More... | |
A static interface for registering cleanup functions that are called when the process terminates abnormally.
On unix this relates to signals like SIGTERM, SIGINT etc.
Definition at line 39 of file gcleanup.h.
|
static |
Adds the given handler to the list of handlers that are to be called when the process terminates abnormally.
The handler function must be fully reentrant, hence the SignalSafe dummy parameter. The 'arg' pointer is kept.
Definition at line 116 of file gcleanup_unix.cpp.
|
static |
Ensures that the cleanup functions are also called via atexit(), in addition to abnormal-termination signals.
This can be useful when ancient third-party library code (eg. Xlib) might call exit(), but be careful to disable these exit handlers before normal termination by calling atexit(false).
Definition at line 121 of file gcleanup_unix.cpp.
|
staticnoexcept |
Temporarily blocks signals until release()d.
This should be used before creating threads so that only the main thread does signal handling.
Definition at line 126 of file gcleanup_unix.cpp.
|
static |
An optional early-initialisation function. May be called more than once.
Definition at line 111 of file gcleanup_unix.cpp.
|
staticnoexcept |
Releases block()ed signals.
Definition at line 131 of file gcleanup_unix.cpp.
|
static |
A strdup() function that makes it clear in the stack trace that leaks are expected.
Definition at line 136 of file gcleanup_unix.cpp.
|
static |
A strdup() function that makes it clear in the stack trace that leaks are expected.
Definition at line 141 of file gcleanup_unix.cpp.