Lua was being used by the main thread and the audio thread. This seemed fine right up until blocking IO would corrupt the the Lua stack, and then everything would go to hell. Now there's a ring buffering system in the main thread that the audio thread can pull from, and blocking IO is handled by a pthread and some shared memory with a seemingly-sketchy-but-actually-safe lock system.
Lua was being used by the main thread and the audio thread. This seemed fine right up until blocking IO would corrupt the the Lua stack, and then everything would go to hell. Now there's a ring buffering system in the main thread that the audio thread can pull from, and blocking IO is handled by a pthread and some shared memory with a seemingly-sketchy-but-actually-safe lock system.