48 using FdDatas = std::vector<FdData>;
95 bool isRunning() const noexcept {
return _isRunnning.load(std::memory_order::acquire); }
98 FdDatas::iterator _getFdData(
BorrowedFd fd)
noexcept;
99 FdDatas::const_iterator _getFdData(
BorrowedFd fd)
const noexcept;
102 std::atomic_bool _shouldContinue{
false};
103 std::atomic_bool _isRunnning{
false};
109 std::queue<Callback> _deferedCb;
Convenience macros to explicitly control copy and move semantics.
Non-owning wrapper around a file descriptor.
Definition BorrowedFd.hpp:37
~EPollPoller()
Destroys the poller and releases kernel resources. The poller must not be running while being destroy...
void exec()
Runs the event loop until stopping is requested.
EPollPoller()
Constructs the poller and initializes underlying kernel resources.
DISABLE_COPY_AND_MOVE(EPollPoller)
Non-copyable, non-movable.
void wake()
Wakes the event loop. Useful when a stop has been requested while the loop is blocked in epoll_wait()...
void deregisterFd(BorrowedFd fd) noexcept override
Deregisters a file descriptor from the poller.
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:95
void registerFd(BorrowedFd fd, EventInterests events, FdCallback cb) override
Registers a file descriptor with the poller.
void requestStop() noexcept
Requests the event loop to stop (non-blocking).
void stop()
Stops the event loop.
Bitset wrapper for dfx::FdWatch::EventInterest values.
Abstract interface for FD-based event polling.
Definition Poller.hpp:37
Definition SocketClient.hpp:23
std::function< void(BorrowedFd, EventTriggers)> FdCallback
Invoked when events occur on a watched file descriptor.
Definition Callback.hpp:28
std::move_only_function< void()> Callback
Generic move-only callback with no arguments.
Definition Callback.hpp:31