Jump to content
  • Advertisement
Sign in to follow this  
Kaptein

Relinquish cpu

This topic is 1619 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm implementing a wait() function, which I want to be multiplatform, and hopefully not use sleep().

 

Are there any functions on win and linux that allows you to just relinquish cpu time immediately?

I realize that sleep() does this, but I want to know what the alternatives are?

I'm guessing there are none, but I'm asking anyways.

 

 

Share this post


Link to post
Share on other sites
Advertisement

I do not like the sleep function because it causes a fixed delay.  I would loop a little bit and use the clock function.  It is under the ctime namespace or I believe time.h

Share this post


Link to post
Share on other sites

Neither system is a real-time operating system.  You can yield your time, but there are no guarantees about when the OS will reschedule you.

 

In fast-paced games usually the best bet is to wait for the screen buffer to flip. The major rendering APIs have blocking calls for that.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!