Manages POSIX signals for the application.
More...
#include <signal_handling.hpp>
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.
◆ SignalHandler()
Core::SignalHandler::SignalHandler |
( |
| ) |
|
|
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.
◆ handle_SIGINT()
void Core::SignalHandler::handle_SIGINT |
( |
int | signal | ) |
|
|
staticprivatenoexcept |
◆ handle_SIGUSR1()
void Core::SignalHandler::handle_SIGUSR1 |
( |
int | signal | ) |
|
|
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.
- Parameters
-
signal | The signal number (ignored in this implementation). |
◆ handle_SIGUSR2()
void Core::SignalHandler::handle_SIGUSR2 |
( |
int | signal | ) |
|
|
staticprivatenoexcept |
Handles the SIGUSR2 signal.
This static function is intended to handle the SIGUSR2 signal. (Implementation pending.)
- Parameters
-
signal | The signal number (ignored in this implementation). |
◆ is_sigint_raised()
static bool Core::SignalHandler::is_sigint_raised |
( |
| ) |
|
|
inlinestaticnodiscard |
◆ is_usr1_raised()
static bool Core::SignalHandler::is_usr1_raised |
( |
| ) |
|
|
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
.
- Exceptions
-
std::runtime_error | If the SignalHandler instance has not been initialized. |
- Returns
true
if SIGUSR1 was raised since the last query; false
otherwise.
◆ is_usr2_raised()
static bool Core::SignalHandler::is_usr2_raised |
( |
| ) |
|
|
inlinestaticnodiscard |
◆ f_sigint_raised
bool Core::SignalHandler::f_sigint_raised |
|
private |
◆ f_usr1_raised
bool Core::SignalHandler::f_usr1_raised |
|
private |
Flag to indicate if the SIGUSR1 signal was triggered.
◆ f_usr2_raised
bool Core::SignalHandler::f_usr2_raised |
|
private |
◆ instance
The documentation for this class was generated from the following files: