18#include <dfx-utilities/OwnedFd.hpp>
52 using FdDatas = std::vector<FdData>;
89 void exec(std::stop_token stopToken);
117 void _execImpl(std::stop_token stopToken);
123 std::stop_source _stopSource;
124 bool _isRunnning =
false;
130 std::queue<Callback> _deferedCb;
Convenience macros to explicitly control copy and move semantics.
void updateFdEvents(Utils::BorrowedFd fd, EventInterests events) override
Update the list of event that this fd is attached to.
void registerFd(Utils::BorrowedFd fd, EventInterests events, FdCallback cb) override
Registers a file descriptor with the poller.
DFX_DISABLE_COPY_AND_MOVE(EPollPoller)
Non-copyable, non-movable.
void exec()
Runs the event loop until stopping is requested.
void deregisterFd(Utils::BorrowedFd fd) noexcept override
Deregisters a file descriptor from the poller.
EPollPoller()
Constructs the poller and initializes underlying kernel resources.
void wake()
Wakes the event loop. Useful when a stop has been requested while the loop is blocked in epoll_wait()...
void deferCall(Callback cb) override
Defer the call to the callback to the next time the event loop is reached.
bool isRunning() const noexcept
Returns whether the event loop is currently running.
Definition EPollPoller.hpp:114
void requestStop() noexcept
Requests the event loop to stop (non-blocking).
void exec(std::stop_token stopToken)
Runs the event loop until stopToken.stop_requested() returns true.
void stop()
Stops the event loop.
Bitset wrapper for dfx::FdWatch::EventInterest values.
Abstract interface for FD-based event polling.
Definition Poller.hpp:37
Non-owning wrapper around a file descriptor.
Definition BorrowedFd.hpp:33
Owning RAII wrapper around a file descriptor.
Definition OwnedFd.hpp:36
Definition SocketClient.hpp:23
std::move_only_function< void()> Callback
Generic move-only callback with no arguments.
Definition Callback.hpp:31
std::function< void(Utils::BorrowedFd, EventTriggers)> FdCallback
Invoked when events occur on a watched file descriptor.
Definition Callback.hpp:28