pub fn poll(fds: &mut [PollFd], timeout: c_int) -> Result<c_int>
Expand description
poll
waits for one of a set of file descriptors to become ready to perform I/O.
(poll(2)
)
fds
contains all PollFd
to poll.
The function will return as soon as any event occur for any of these PollFd
s.
The timeout
argument specifies the number of milliseconds that poll()
should block waiting for a file descriptor to become ready. The call
will block until either:
- a file descriptor becomes ready;
- the call is interrupted by a signal handler; or
- the timeout expires.
Note that the timeout interval will be rounded up to the system clock
granularity, and kernel scheduling delays mean that the blocking
interval may overrun by a small amount. Specifying a negative value
in timeout means an infinite timeout. Specifying a timeout of zero
causes poll()
to return immediately, even if no file descriptors are
ready.