2009年6月4日 星期四

suspend some seconds in the Linux/Windows

Linux
- sleep(n), , suspend n seconds
- usleep(n), suspend n * 10(-6) seconds

Windows
- Sleep(n) , suspend n * 10(-6) second

We can also use select to suspend n seconds m 10(-6) seconds

struct timeout tv;
tv.tv_sec = n;
tv.tv_usec = m;
select(0, NULL, NULL, NULL, &tv);

Then this function will suspend n seconds m 10(-6) seconds

沒有留言: