gpt4 book ai didi

c++ - select(NULL, NULL, NULL, &timeout) 只是等待给定的时间吗?

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:57:56 37 4
gpt4 key购买 nike

我在给定的代码中看到了以下行:

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/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com