67 void defer(std::function<
void()> callback);
71 int wait(
int timeoutMs = -1);
86 struct Registration {
int fd;
Callback callback; };
90 std::chrono::milliseconds delay;
91 std::chrono::milliseconds interval;
92 std::uint64_t version = 0;
95 TimerId addTimer(std::chrono::milliseconds delay,
96 std::chrono::milliseconds interval,
99 void dispatchDeferred();
101 std::uint64_t drainEvent(
int fd);
102 void signalEvent(
int fd)
noexcept;
106 std::vector<epoll_event> m_ready;
107 std::uint64_t m_nextToken = 1;
110 std::unordered_map<std::uint64_t, Registration> m_registrations;
111 std::unordered_map<int, std::uint64_t> m_byFd;
112 std::unordered_map<TimerId, Timer> m_timers;
113 std::deque<std::function<void()>> m_deferred;
115 std::atomic<bool> m_stopRequested{
false};
116 std::atomic<bool> m_waiting{
false};