-
November 16th, 2010, 04:08 PM
#1
Idle for some microseconds without occupying CPU time?
Is there such a function that idles the program for some specified number of microseconds but does not consume CPU time? I use a loop and gettimeofday() but that keeps the CPU from doing other things. Thanks!
-
November 16th, 2010, 04:10 PM
#2
Re: Idle for some microseconds without occupying CPU time?
On Windows, there's Sleep(). However, you cannot guarantee exactly when that will return because Windows is not a real-time OS---it only promises to relinquish control for at least the specified number of milliseconds.
In practice, you'll probably see about 10ms as the mimimum sleep time.
-
November 16th, 2010, 04:11 PM
#3
Re: Idle for some microseconds without occupying CPU time?
sleep(milliseconds)
It's not standard as far as I know, but all POSIX based systems (most UNIX and Linux) support it.
-
November 16th, 2010, 04:11 PM
#4
Re: Idle for some microseconds without occupying CPU time?
You're probably looking for something like sleep or Sleep.
-
November 17th, 2010, 09:39 AM
#5
Re: Idle for some microseconds without occupying CPU time?
Thank you all!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|