日期:2014-05-16  浏览次数:20790 次

如何让poll函数永久阻塞
函数
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.