[SDL] failure at SDL_AddEvent()

Will Benton willb at cs.wisc.edu
Sat Nov 9 16:01:01 PST 2002


On Saturday, November 9, 2002, at 05:06  PM, Daniel Goertzen wrote:

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

Unless I'm missing something, the address of "event" will be invalid 
(i.e. will not point to an SDL_Event) at the point of 
sdl_timer_callback's  return (since event is on the stack).  This would 
be a big problem unless SDL_PushEvent causes a context switch to the 
waiting thread (meaning that "event" is consumed before it is no longer 
on the stack).

Even in that case, it would appear to be MP-unsafe.  Is this correct?



best,
wb





More information about the SDL mailing list