[SDL] Re: Some multithreaded improvement to the event queue...
Marc A. Pelletier
marc at abovesecurity.com
Tue Sep 13 11:41:19 PDT 2005
Bob Pendleton wrote:
> Good luck. I released a replacement library that does just what you did
> http://gameprogrammer.com/fastevents/fastevents1.html I did it that way
> because I could not get agreement to put code like yours into SDL. It
> wasn't accepted because SDL runs on operating systems that do not
> support threads.
This may not be such a problem; my patch does nothing unless you
specifically request SDL_INIT_EVENTTHREAD (and get it) so OSes that do not
support thread will not be affected.
And, indeed, on platforms which /do/ support threads, the actual semantics
are left unchanged: SDL_WaitEvent() will return faster once an event is
available and not hog (part of) the CPU while it waits, but will otherwise
act exactly as it always had.
The only other change (not dropping events when the queue is full) is
arguably a bugfix. I wouldn't expect any library user is legitimately
relying on events being lost. :-) (And, a fixed queue length is somewhat
less an issue on platforms which do not support threads given that events
will be added to the queue only when the program is actively reading those
events-- you can't loose events simply because you happened to be busy
doing something else).
-- Marc A. Pelletier
More information about the SDL