我在给定的代码中看到了以下行:
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.
所以我可以看到将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.
取自here .
关于c++ - select(NULL, NULL, NULL, &timeout) 只是等待给定的时间吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27297184/