[SDL] failure at SDL_AddEvent()

Daniel Goertzen goertzen at ertw.com
Sat Nov 9 15:08:01 PST 2002


Should work as long as you never ever modify session->event from the main
thread while timers are on.  Maybe try something like to make sure you
aren't tripping yourself up on the threading:

static Uint32 sdl_timer_callback(ep_session *session) {
SDL_Event event;
<fill in event with CONSTANT values>
 SDL_PushEvent(&event);
 return (55);
 }

Cheers,
Dan.

----- Original Message -----
From: "Chris Thielen" <chris at luethy.net>
To: <sdl at libsdl.org>
Sent: Saturday, November 09, 2002 4:32 PM
Subject: [SDL] failure at SDL_AddEvent()


> hello,
> in my attempts to use SDL timers in my code, I have a structure which
> contains a SDL_Event variable and a timer callback:
>
> static Uint32 sdl_timer_callback(ep_session *session) {
> SDL_PushEvent(&session->event);
> return (55);
> }
>
> which uses SDL_PushEvent() to push an event into that structure's event.
> The only thing in the main thread is SDL_WaitEvent(), and for some
> reason, when SDL_PushEvent() is run, the code seg faults, and a
> backtrace shows it's in SDL_AddEvent(). Am I missing something here? I
> thought it was always safe to call SDL_PushEvent() from a SDL timer
> callback.
>
> --
> Chris Thielen <chris at luethy.net>
>
>
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
>





More information about the SDL mailing list