Yielding the CPU?

Hi,
I am still quite new to SDL. I noticed many tutorials use this, after flipping the screen

while( fps.get_ticks() < 1000 / FRAMES_PER_SECOND )
{
//wait
}

To maintain the correct FPS.
This doesn’t seem very nice to the CPU, because it will keep CPU utilization to 100% for no reason.
I was wondering. Does SDL have a function that will yield the CPU for the rest of this quantum (or for some given time)?

If not, what is the name of the function that was used to achieve this in Windows? (Sorry, my memory fails me!)

Thank you very much in advance.---------------------------------
Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new and used cars.

SDL_Delay(# of clock ticks)On 1/23/06, Mohamed El Dawy wrote:

Hi,
I am still quite new to SDL. I noticed many tutorials use this, after
flipping the screen

while( fps.get_ticks() < 1000 / FRAMES_PER_SECOND )
{
//wait
}

To maintain the correct FPS.
This doesn’t seem very nice to the CPU, because it will keep CPU
utilization to 100% for no reason.
I was wondering. Does SDL have a function that will yield the CPU for the
rest of this quantum (or for some given time)?

If not, what is the name of the function that was used to achieve this in
Windows? (Sorry, my memory fails me!)

Thank you very much in advance.


Yahoo! Autoshttp://us.rd.yahoo.com/evt=38381/+ylc=X3oDMTEzcGlrdGY5BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDMWF1dG9z/*http://autos.yahoo.com/index.html+.
Looking for a sweet ride? Get pricing, reviews, & more on new and used cars.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Cheers,
Josh

PGP: http://revvy.box43.net/Josh_Matthews.asc