BioCMAMC-ST
|
Manages POSIX signals for the application. More...
#include <signal_handling.hpp>
Public Member Functions | |
SignalHandler () | |
Constructor for SignalHandler. | |
~SignalHandler ()=default |
Static Public Member Functions | |
static bool | is_usr1_raised () noexcept(false) |
Checks if the SIGUSR1 signal has been raised. | |
static bool | is_usr2_raised () noexcept(false) |
static bool | is_sigint_raised () noexcept(false) |
Static Private Member Functions | |
static void | handle_SIGUSR1 (int signal) noexcept |
Handles the SIGUSR1 signal. | |
static void | handle_SIGUSR2 (int signal) noexcept |
Handles the SIGUSR2 signal. | |
static void | handle_SIGINT (int signal) noexcept |
Private Attributes | |
bool | f_sigint_raised |
bool | f_usr1_raised |
bool | f_usr2_raised |
Static Private Attributes | |
static SignalHandler * | instance = nullptr |
Singleton instance of the SignalHandler. |
Manages POSIX signals for the application.
Singleton that captures specific POSIX signals (e.g., SIGUSR1 and SIGUSR2) during the runtime of the application. It provides mechanisms to check if signals have been raised and ensures proper cleanup and handling.
|
explicit |
Constructor for SignalHandler.
Sets up the signal handlers for SIGUSR1 and SIGUSR2. Throws a runtime error if more than one instance of SignalHandler is created.
|
default |
|
staticprivatenoexcept |
|
staticprivatenoexcept |
Handles the SIGUSR1 signal.
This static function is called when the SIGUSR1 signal is raised. It sets the internal flag to indicate the signal was received.
signal | The signal number (ignored in this implementation). |
|
staticprivatenoexcept |
Handles the SIGUSR2 signal.
This static function is intended to handle the SIGUSR2 signal. (Implementation pending.)
signal | The signal number (ignored in this implementation). |
|
inlinestaticnodiscard |
|
inlinestaticnodiscard |
Checks if the SIGUSR1 signal has been raised.
This function is used to query the state of the SIGUSR1 signal. If the signal has been raised, the function returns true and resets the internal flag to false.
std::runtime_error | If the SignalHandler instance has not been initialized. |
|
inlinestaticnodiscard |
|
private |
|
private |
Flag to indicate if the SIGUSR1 signal was triggered.
|
private |
|
staticprivate |
Singleton instance of the SignalHandler.