lua-users home
lua-l archive

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


On 2/2/06, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
Ok, but that does not mean you need need synchronization between the Lua states.
So, no need for lua_lock and friends.
--lhf

Hmm, in that case what is the point of having locking available at all?

Consider Thread A is running some Lua code and it needs to update a value in Thread B which also running a Lua program.  How does the value get from Thread A to Thread B without locking?   They are both actively running code.  As far as I know the only possible way would be for Thread B to be polling for changes or something (which is not what you want in a multithreaded application).

Maybe the locking in Lua works completely different from what I am thinking, I don't know.  It doesn't seem very thread friendly.

--
// Chris