4 ms·
I find that you already have an event loop built on top of poll/epoll/io_uring, maintaining a timer heap (or wheel) in userspace and setting the polling timeout
by gpderetta 2y ago
I find that you already have an event loop built on top of poll/epoll/io_uring, maintaining a timer heap (or wheel) in userspace and setting the polling timeout to the next expiration is the easiest and more efficient solution. Use an eventfd to force an early wakeup if you modify timers concurrently with your waits.
The most annoying thing is that epoll supports timeouts smaller than a millisecond only since 5.11.
edit: that's literally what's described under "All OSes: timers fully implemented in userspace ", including the comment about epoll low resolution.