lua-users home
lua-l archive

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


2012/5/22 Tezduyar Lindskog, Umut <Umut.TezduyarLindskog@sonymobile.com>:
> Erik, thank you for your answer.
> Patrik, what I understand from "lua_State is fully thread safe" statement is more than one thread can work on the same lua_State simultaneously? Is this what you meant? If so, what are the synchronization primitives used by lua to support this feature?

lua_State is NOT thread safe. I guess what Eric/Patric meant is that
it is not unsafe to use separate lua_States by different threads
exclusively as there is no hidden shared state between lua_States.
That being said it is possible to make lua_State thread safe by means
of lua_lock() and lua_unlock() (but it is being reported to be very
performance degrading).

Cheers,
Simon

>
> Thanks.
>
> -----Original Message-----
> From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On Behalf Of Patrick Rapin
> Sent: Tuesday, May 22, 2012 10:57 AM
> To: Lua mailing list
> Subject: Re: Is having lua_State per thread safe?
>
>> A lua_State is completly isolated, so they are thread safe. (Has been since
>> Lua 4.0)
>
> Until Lua 5.0, the parser was not completely reentrant.
> So it is more correct to say that a lua_State is fully thread safe
> since Lua 5.1.
>
>