c、unix中的睡眠功能 [英] sleep function in c, unix

查看:25
本文介绍了c、unix中的睡眠功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要导入什么才能在 unix 中使用睡眠功能?我知道 Windows 是 windows.h,但是 unix 呢?

What do i need to import to use the sleep function in unix? i know it's windows.h for windows, but what about unix?

推荐答案

应该在 unistd.h 中.

It should be in unistd.h.

请注意,这只能提供整数秒的精度.

Please note that this gives you only a precision of integral seconds.

亚秒级精度最便携的方法应该是(ab-)使用 select().

The most portable way for sub-second precision should be (ab-)using select().

这篇关于c、unix中的睡眠功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆