Class EpollManager
Defined in File agnocast_epoll.hpp
Class Documentation
-
class EpollManager
A facade class that manages event waiting via epoll, primarily used by the Executor.
Public Functions
-
explicit EpollManager(EventHandlerArray sources)
- Parameters:
sources – An array of event handlers mapped by event type. Every slot in this array must contain a valid handler instance.
-
~EpollManager()
-
EpollManager(const EpollManager&) = delete
-
EpollManager &operator=(const EpollManager&) = delete
-
EpollManager(EpollManager&&) = delete
-
EpollManager &operator=(EpollManager&&) = delete
-
bool add_event(int fd, EpollEventType type, EpollEventLocalID local_id) const
Directly adds a new event to be monitored by epoll.
- Parameters:
fd – The file descriptor associated with the event.
type – The category of the event.
local_id – The unique local ID specific to this event.
- Returns:
true on success, or false on failure.
-
void prepare_epoll(const CallbackGroupValidator &validate_callback_group)
Updates the set of events monitored by epoll (e.g., adding or removing events).
This function works together with EpollUpdateTracker. When the Executor is notified that the target events have changed, it calls this function.
- Parameters:
validate_callback_group – A function that takes a callback group and determines whether the entities belonging to that group are under its management.
-
void wait_and_handle_epoll_event(int timeout_ms)
Waits for events to occur and executes their corresponding handlers.
- Parameters:
timeout_ms – The maximum time to wait in milliseconds.
-
explicit EpollManager(EventHandlerArray sources)