一段c++代码实现睡眠功能
2021-06-29 14:05
标签:str unknown har 代码 def time define 实现 delay #ifdef ACL_UNIX tv.tv_sec = delay / 1000; 一段c++代码实现睡眠功能 标签:str unknown har 代码 def time define 实现 delay 原文地址:https://www.cnblogs.com/winstonet/p/9645823.html
struct timeval tv;
tv.tv_usec = (suseconds_t) (delay - tv.tv_sec * 1000) * 1000;
while (select(0, (fd_set *) 0, (fd_set *) 0, (fd_set *) 0, &tv) if (acl_last_error() != ACL_EINTR) {
char tbuf[256];
acl_msg_fatal("doze: select: %s",
acl_last_strerror(tbuf, sizeof(tbuf)));
}
#elif defined(ACL_WINDOWS)
Sleep(delay);
#else
#error "unknown OS"
#endif