当前位置: 技术问答>linux和unix
如何让poll函数永久阻塞
来源: 互联网 发布时间:2016-03-01
本文导语: 函数 int poll(struct pollfd * fds, int numfds, int timeout); 其中timeout是设置超时时间量,如果设置为0,则poll函数不阻塞, 但是如何让他一直阻塞不超时,直到其中的fds满足条件,timeout 应当设置为何值? |...
函数
int poll(struct pollfd * fds, int numfds, int timeout);
其中timeout是设置超时时间量,如果设置为0,则poll函数不阻塞,
但是如何让他一直阻塞不超时,直到其中的fds满足条件,timeout 应当设置为何值?
int poll(struct pollfd * fds, int numfds, int timeout);
其中timeout是设置超时时间量,如果设置为0,则poll函数不阻塞,
但是如何让他一直阻塞不超时,直到其中的fds满足条件,timeout 应当设置为何值?
|
timeout 用INFTIM
If timeout is neither zero nor INFTIM (-1), it specifies a maximum inter-
val to wait for any file descriptor to become ready, in milliseconds. If
timeout is INFTIM (-1), the poll blocks indefinitely. If timeout is
zero, then poll() will return without blocking.
If timeout is neither zero nor INFTIM (-1), it specifies a maximum inter-
val to wait for any file descriptor to become ready, in milliseconds. If
timeout is INFTIM (-1), the poll blocks indefinitely. If timeout is
zero, then poll() will return without blocking.