lua-users home
lua-l archive

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


On 2/2/06, Ben Sunshine-Hill <sneftel@gmail.com> wrote:
If you are going to access the SAME Lua "universe" (created by
lua_open) from DIFFERENT threads, you'll need it.
>  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?

If they are different lua universes, it won't. They'll be different
lua universes, and values will not be shared. If they are the SAME lua
universe, as above, you use lua_lock.

That doesn't make sense to me.  Different universes accessing each other is the same thing as as the same universe from different threads.  They are both native threads, doesn't matter if they are Lua universes or not.

I am strictly not speaking about coroutines.  Maybe that's all the locking in Lua is for, I don't know.  I'm talking purely native threads here.

--
// Chris