[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LuaThread sources?
- From: Sean Conner <sean@...>
- Date: Wed, 2 Jan 2019 16:52:38 -0500
It was thus said that the Great Sven Olsen once stated:
> I've started to wonder what it would look like to mod the Lua VM to allow
> multiple threads to run in parallel while referencing the same global Lua
> state. I'm imagining an approach that basically just boils down to
> slipping some mutex locks into the VM to avoid possible memory corruption
> when two threads try to write to the same table at the same time, which
> feels like it might be more or less sufficient to allow a preemptive
> shared-state multithreading mod that would be relatively safe.
In theory, all you need to do is provide definitions for lua_lock() and
lua_unlock() (which are currently #defined to be nothing) and recompile Lua.
-spc