lua-users home
lua-l archive

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

2008/7/23 Manish Jain <>:
>>> Without LuaThread you can have several independent Lua states, even
>>> many of them, and in that case LuaJIT will work just as expected. You
>>> will have to use special mechanisms to share data between the Lua
>>> states, and there are many libs around there doing that, the authors
>>> of the active ones will probably answer this topic soon.
> We are not using LuaThread. We are calling Lua functions from C code.
> And there will be multiple threads in C code those will be calling same
> lua function in parallel.

You cannot access a single Lua state simultaneously from several
threads. You have to implement a locking mechanism, as Ong hean kuan
suggested. That's what LuaThread does, and you are probably already
doing it since otherwise you generally get problems quickly.

In that situation (a single locked Lua state), the use of LuaJIT is
transparent, it's a drop-in replacement for the default Lua