[SDL] FastEvents question (for Bob or anyone who knows)
Mason Wheeler
masonwheeler at yahoo.com
Mon May 5 09:18:20 PDT 2008
The notes on FastEvents say that only the thread that initialized SDL should be used to call FE_PollEvent() or FE_WaitEvent(). I'm curious as to why that is, since it seems to me to be completely backwards for a multithreaded game.
The main thread has to be used for rendering. As I understand it, this is an invariant. The main thread MUST be your rendering thread. Problem with doing event handling on the same thread is that it's conceivable for certain commands to use blocking behavior. (My game engine, which I'm trying to port to SDL does this in fact. There are a handful of keyboard commands that call Sleep() as part of their handler.) Doing this on the rendering thread is a bad idea for obvious reasons.
Is there a particular reason why the FastEvents reading functions should only happen on the main thread, and is there a modification that could be made to work around the restriction?
Mason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20080505/2452aea2/attachment.htm>
More information about the SDL
mailing list