qb
2.0.0.0
C++17 Actor Framework
|
Event for handling system signals asynchronously. More...
#include <signal.h>
Public Types | |
using | base_t = base<ev::sig> |
Base type alias for base<ev::sig>. | |
Public Types inherited from qb::io::async::event::base< ev::sig > | |
using | ev_t |
Alias for the underlying libev event watcher type. |
Public Member Functions | |
signal (ev::loop_ref loop) | |
Constructor. | |
Public Member Functions inherited from qb::io::async::event::base< ev::sig > | |
base (ev::loop_ref loop) | |
Constructor. |
Additional Inherited Members | |
Public Attributes inherited from qb::io::async::event::base< ev::sig > | |
IRegisteredKernelEvent * | _interface |
Pointer to the kernel event interface responsible for handling this event. | |
int | _revents |
Stores the event flags (e.g., EV_READ, EV_WRITE) received from libev when the event triggers. |
Event for handling system signals asynchronously.
This template class extends qb::io::async::event::base<ev::sig> and thus wraps an ev::sig watcher from libev. It is used to watch for specific system signals (e.g., SIGINT, SIGTERM) and trigger callbacks when they occur. The signal to watch is typically specified as a template parameter.
_SIG | The signal number to watch (e.g., SIGINT, SIGTERM). If -1 (the default for the specialized version), the signal number must be set dynamically using the set() method of the underlying ev::sig watcher. |
Usage Example:
|
inlineexplicit |
Constructor.
Creates a signal watcher for the specified signal number (if provided as template argument).
loop | Reference to the libev event loop (ev::loop_ref) this watcher will be associated with. |