lua-users home
lua-l archive

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


2013/6/20 Javier Guerra Giraldez <javier@guerrag.com>:
> On Thu, Jun 20, 2013 at 3:21 PM, David Demelier
> <demelier.david@gmail.com> wrote:
>> I use the same Lua state for different threads but each of the
>> lua_pcall is protected by mutexes. Is this enough?
>
>
> not only lua_pcall(), but every Lua API call to the same state.
>
> you should read/modify/execute a single Lua State concurrently from two threads.
>
> --
> Javier
>

Yes of course, in fact, each server (which is a thread in my
application) calls Lua plugins on events. Before doing this, it will
lock the Lua state for any Lua functions so no other thread is able to
do anything else with the Lua state until the thread finished.

--
Demelier David