什么民意调查()做的0超时? [英] What does poll() do with a timeout of 0?
问题描述
我在看调查()
的 手册页 ,它告诉我,民调()
时,正值和负值传递在超时参数。它不会不告诉我,如果超时是发生了什么 0
。 任何想法?
I'm looking at the poll()
man page, and it tells me the behaviour 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?
综观 epoll_wait()
的手册页,它告诉我,以 0
,它会立即返回,即使没有可用的事件。它是安全的假设,调查()
将行为相同的方式?
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?
推荐答案
它会立即返回:
如果超时大于零,它指定一个最大时间间隔(毫秒)等待任何文件描述符准备就绪。如果超时值为零,那么调查()
将返回而不阻塞。如果超时值为 1
的调查
无限期阻塞。
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.
,作为的Mac OS X 10.5
;
最大时间间隔,以等待调查完成,以毫秒为单位。如果这个值是0,调查()
将立即返回。如果此值 INFTIM(-1)
,调查()
直到条件被发现会无限期地阻塞。
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.
,作为 OpenBSD的3.8
这篇关于什么民意调查()做的0超时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!