[SDL] Using separate threads...

Santiago Romero nop at todolinux.org
Thu Apr 27 06:52:01 PDT 2000


Mattias Engdegård wrote:

> I would sleep for most part of the inter-frame delay, and then spin in a
> loop, polling for vertical retrace. Either sleep on a timer (if your
> tick granularity is good enough), or (on Linux) use the rtc device.
> The reward of not hogging 100% CPU is that you aren't penalized for
> gobbling up your entire timeslice all the time...

The beginning of your answer (sleeping for the inter-frame delay) is
okay with me, but why poll for vertical retrace? As soon as the
inter-frame delay is finish, fire off a blit command to the video
accelerator (with the "wait for vretrace flag" enabled) and start
preparing the next frame right away!

-- 
Pierre Phaneuf
http://ludusdesign.com/



More information about the SDL mailing list