返回> 网站首页
使用select延时
yoours2021-05-01 22:05:35
简介一边听听音乐,一边写写文章。
void usleep(unsigned long usec)
{
struct timeval tv;
tv.tv_sec = usec / 1000000;
tv.tv_usec = usec % 1000000;
int err;
do {
err = select(0, NULL, NULL, NULL, &tv);
} while(err < 0 && errno == EINTR);
}
文章评论
2396人参与,0条评论