Event creation and Threads

if events must be removed and placed in the queue by the same thread. when do they get placed in the queue? when I call the update screen function?

I always thought the point of an event queue was so that one thread could place events on the stack and another could remove them and handle them.

SDL_PushEvent place the event in the queue at the time it is called.
There is no delay. BTW, SDL_PushEvent is thread safe and can be called
from any thread. It is very much intended to be used for threads to
communicate with the main loop. OTOH, you really should only read the
queue from one main thread, that is the thread.

The behavior of SDL_PushEvent is documented in the SDL docwiki. I
don’t know where you got the idea about the queue that you have, but
it doesn’t match the documented behavior.

Bob PendletonOn Fri, Jan 15, 2010 at 1:40 PM, Enoch247 wrote:

if events must be removed and placed in the queue by the same thread. when
do they get placed in the queue? when I call the update screen function?

I always thought the point of an event queue was so that one thread could
place events on the stack and another could remove them and handle them.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


±----------------------------------------------------------