lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



The Lua/SDL_mixer integration is having the following problem:

  Lua runs happily, starts to play a tune  ..dam-dam..
  Attaches a callback to get to the rhytm

  Lua continues running..
	--> sdl_mixer gives a C callback -> sdl_mixer module -> Lua call

Now, the callback probably happens in another thread, or otherwise asynchronously to the main loop, running the Lua stack. How do we deal with this?

Should the Lua core be patched to include a "incoming callbacks" queue, or something, which other threads could write and the main Lua execution thread would read (thus, needing no other synchronization). Or do coroutines provide a solution (I think not).

If the "incoming callbacks queue" solution is suitable, has anyone done such already?

-ak