posts - 297,  comments - 15,  trackbacks - 0
转自 http://blog.chinaunix.net/u/22630/showart_1674283.html
在linux下延时可以采用如下函数:
1.unsigned int sleep(unsigned int seconds); 
  sleep()会使当前程序休眠seconds秒。如果sleep()没睡饱,它将会返回还需要补眠的时间,否则一般返回零。 
2.void usleep(unsigned long usec); 
 usleep与sleep()类同,不同之处在于休眠的时间单位为毫秒(10E-6秒)。 
3.int select(0,NULL,NULL,NULL,struct timeval *tv);  
 
  可以利用select实现sleep()的功能,它将不会等待任何事件发生。 
 4.int nanosleep(struct timespec *req,struct timespec *rem); 
  nanosleep会沉睡req所指定的时间,若rem为non-null,而且没睡饱,将会把要补眠的时间放在rem上。
posted on 2009-07-07 20:45 chatler 阅读(1045) 评论(0)  编辑 收藏 引用 所属分类: Linux_SysAdmin
<2010年4月>
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678

常用链接

留言簿(10)

随笔分类(307)

随笔档案(297)

algorithm

Books_Free_Online

C++

database

Linux

Linux shell

linux socket

misce

  • cloudward
  • 感觉这个博客还是不错,虽然做的东西和我不大相关,觉得看看还是有好处的

network

OSS

  • Google Android
  • Android is a software stack for mobile devices that includes an operating system, middleware and key applications. This early look at the Android SDK provides the tools and APIs necessary to begin developing applications on the Android platform using the Java programming language.
  • os161 file list

overall

搜索

  •  

最新评论

阅读排行榜

评论排行榜