On Jun 24, 2014, at 5:53 AM, Austin Einter <firstname.lastname@example.org> wrote:
Just to clarify. Lua itself is “thread friendly” in that the entire Lua code base uses no global state and is fully reentrant. However, each individual lua state, created using lua_newstate() etc can only be used single-threaded. So you can create a dozen user states and have each one running on its own thread, but each state can never be accessed by more than one thread at a time (and you are responsible for ensuring this, not Lua).
Since each lua state also has its own stack, this means that all stack operations are also single-threaded and so issues of stack synchronization across threads should not arise. If you need to synchronize thread access to a Lua state, you should do so in your C code using standard OS primitives such as mutexes.