I'm looking at the poll()
man page, and it tells me the behavior of poll()
when positive and negative values are passed in for the timeout parameter. It doesn't doesn't tell me what happens if timeout is 0
. Any ideas?
Looking at the epoll_wait()
man page, it tells me that with a timeout value of 0
, it will return right away, even if there are no events available. Is it safe to assume that poll()
would behave the same way?
It will return immediately:
If timeout is greater than zero, it specifies a maximum interval (in milliseconds) to wait for any file descriptor to become ready. If timeout is zero, then
poll()
will return without blocking. If the value of timeout is-1
, thepoll
blocks indefinitely.
, as of Mac OS X 10.5
;
Maximum interval to wait for the poll to complete, in milliseconds. If this value is 0,
poll()
will return immediately. If this value isINFTIM (-1)
,poll()
will block indefinitely until a condition is found.
, as of OpenBSD 3.8