给定代码中出现了以下行:
select(0, (fd_set *) NULL, (fd_set *) NULL, (fd_set *) NULL, &timeout);http://linux.die.net/man/2/select
如果不对相应的事件类别观察文件描述符,则可以将三个文件描述符集合中的每一个指定为NULL。
所以我可以看到将NULL传递给它是有效的。 在这种情况下,它只能导致积极等待。
它是否正确? 我有点不确定..
the following line has come to my eyes in given code:
select(0, (fd_set *) NULL, (fd_set *) NULL, (fd_set *) NULL, &timeout);http://linux.die.net/man/2/select
Each of the three file descriptor sets may be specified as NULL if no file descriptors are to be watched for the corresponding class of events.
So I can see that it is valid to pass NULL into it. In that case it can only lead to do active waiting.
Is this correct? I am a bit unsure..
最满意答案
有些代码调用select(),其中所有三个组都为空,nfds为零,非NULL超时作为一种相当便携的方式以亚秒级精度进行休眠。
从这里开始 。
Some code calls select() with all three sets empty, nfds zero, and a non-NULL timeout as a fairly portable way to sleep with subsecond precision.
Taken from here.
更多推荐
发布评论