qb
2.0.0.0
C++17 Actor Framework
|
Base class for all qb-io asynchronous components that interact with the event listener. More...
#include <io.h>
Protected Member Functions | |
base () | |
Constructor that registers the event watcher with the current listener. | |
~base () | |
Destructor that unregisters the event watcher. |
Protected Attributes | |
_EV_EVENT & | _async_event |
Reference to the registered libev-based event watcher. |
Base class for all qb-io asynchronous components that interact with the event listener.
This template class provides the foundational mechanism for registering and unregistering a specific libev event watcher (represented by _EV_EVENT) with the thread-local qb::io::async::listener::current. Derived classes (using CRTP via _Derived) will typically inherit from this to manage their primary event watcher.
_Derived | The derived class type (CRTP pattern). |
_EV_EVENT | The specific qb::io::async::event::* type (which wraps a libev watcher, e.g., event::io, event::timer). |
|
inlineprotected |
Constructor that registers the event watcher with the current listener.
The _async_event member is initialized by calling listener::current.registerEvent, associating the derived class instance (Derived) as the handler for this event type.
|
inlineprotected |
Destructor that unregisters the event watcher.
Stops the event watcher and unregisters it from the listener to prevent dangling references and ensure proper cleanup of libev resources. Specifically, it calls _async_event.stop() and then listener::current.unregisterEvent(_async_event._interface).