sleep()函数的原型为:
unsigned int sleep(unsigned int seconds);
如果我只是想睡眠几个毫秒的时候,我只能把参数搞成float或者double,尽管可以运行,不过要出警告,很是不爽,不知道有什么好的办法可以睡眠几个毫秒的????
顺便说一句:windows下的Sleep函数参数为毫秒数。
谢谢!!!!
...全文
807714打赏收藏
请教Linux下的sleep()函数。。。
sleep()函数的原型为: unsigned int sleep(unsigned int seconds); 如果我只是想睡眠几个毫秒的时候,我只能把参数搞成float或者double,尽管可以运行,不过要出警告,很是不爽,不知道有什么好的办法可以睡眠几个毫秒的???? 顺便说一句:windows下的Sleep函数参数为毫秒数。 谢谢!!!!
If your Linux OS adopts kernel 2.6.x, you can use nanosleep or select call to implement your requirement. If 2.4.x, it does not support that precision.