Rici Lake wrote:
The coroutine mechanism is not implemented with threads, although the API calls them threads (which they are, but not OS threads); Lua threads are exposed as instances of a Lua_State, and those Lua_States are related to each other. You probably don't want to run those simultaneously in different OS threads, but it is theoretically possible; the language does not provide any synchronization primitives, though, so you need to implement your own so that related Lua_States don't trod on each other's globals.I keep wondering about this; wouldn't the garbage collector require some synchronization, in order to avoid trouble with multiple Lua-threads running in multiple OS-threads?
-Johann