lua-users home
lua-l archive

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


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