首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > UNIXLINUX >

怎么让poll函数永久阻塞

2012-02-12 
如何让poll函数永久阻塞函数intpoll(structpollfd*fds,intnumfds,inttimeout)其中timeout是设置超时时间

如何让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.

热点排行
Bad Request.