According to the mio::Poll
docs:
The function will block until either at least one readiness event has been received or timeout has elapsed. A timeout of None means that poll will block until a readiness event has been received. ... Note that the timeout will be rounded up to the system clock granularity (usually 1ms), and kernel scheduling delays mean that the blocking interval may be overrun by a small amount.
Meanwhile, Linux's select()
has the zero timeout feature:
If both fields of the timeval structure are zero, then select() returns immediately. (This is useful for polling.)
What is Mio's behaviour on a Duration::from_secs(0)
, would it work like Linux's select()
?
I suppose you want a Linux answer cause you link to a Linux manual.
mio
usesepoll()
, notselect()
, on Linux:And the relevant quote from
epoll()
is:So,
Duration::from_secs(0)
will not wait for incoming event. You can check the code ofmio
hereWe can see that the behavior of
mio
will copy the behavior ofepoll()
.