The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Yielding the CPU?
Mohamed El Dawy
Guest

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20060123/4ce186d7/attachment.html
Yielding the CPU?
Josh Matthews
Guest

SDL_Delay(# of clock ticks)

On 1/23/06, Mohamed El Dawy <msdawy at yahoo.com> wrote:
Quote:

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<http://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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20060123/1d376db9/attachment.htm