lua-users home
lua-l archive

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


Marc Balmer <marc@msys.ch> wrote:

> How difficult would it be to make Lua true multithreaded?  I know that
> is against the intentions of the inventors, but have experiments been
> done in this direction?

I wonder if some middle ground might be easier to implement.
Something like PostScript global vs. local VM, perhpas. In Lua terms
lua_open'ed lua_State would be "global" and subordinate lua_State for
lua threads would be "local".  You can init your global state and
create lua thread per native worker thread.  global state is readonly
for workers and doesn't require mutex protection to access.  It would
be up to the app to ensure local (lua thread) states are not accessed
from multiple native threads (or use suitable locking).

-uwe