|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
POSIX signal handling utilities with RAII semantics. More...
#include <csignal>#include <cstring>#include <iostream>#include <stdexcept>#include <string>#include <initializer_list>#include <aleph.H>Go to the source code of this file.
Classes | |
| class | SignalError |
| Exception thrown when a signal operation fails. More... | |
| class | SignalSet |
| C++ wrapper for sigset_t with a fluent interface. More... | |
| class | SignalBlocker |
| RAII wrapper for temporarily blocking signals. More... | |
| class | Signal |
| RAII wrapper for POSIX signal handler registration. More... | |
| struct | Signal::NoAbortTag |
Functions | |
| int | wait_for_signal (const SignalSet &signals) |
| Utility to wait for a signal. | |
| bool | send_signal_to_self (int signo) noexcept |
| Sends a signal to the current process. | |
| std::string | signal_name (int signo) |
| Returns the name of a signal. | |
| std::string | signal_description (int signo) |
| Returns a human-readable description of a signal. | |
POSIX signal handling utilities with RAII semantics.
This header provides C++ wrappers for POSIX signal handling:
sigset_t with a fluent interface.Signal handlers are process-wide (not per-thread). While the classes in this header are safe to use, be aware that:
pthread_sigmaskSignalBlocker uses sigprocmask (process-wide) by defaultDefinition in file ah-signal.H.
|
inlinenoexcept |
Sends a signal to the current process.
Convenience wrapper for raise().
| signo | The signal to send. |
Definition at line 652 of file ah-signal.H.
Referenced by TEST().
|
inline |
Returns a human-readable description of a signal.
Uses strsignal() if available, otherwise returns the signal name.
| signo | The signal number. |
Definition at line 730 of file ah-signal.H.
References signal_name().
|
inline |
Returns the name of a signal.
Returns the standard POSIX signal name (e.g., "SIGINT", "SIGTERM").
| signo | The signal number. |
Definition at line 665 of file ah-signal.H.
Referenced by signal_description(), and TEST().
|
inline |
Utility to wait for a signal.
Blocks until one of the specified signals is delivered.
| signals | The set of signals to wait for. |
| SignalError | if sigwait fails. |
Definition at line 635 of file ah-signal.H.
References SignalSet::get().