lua-users home
lua-l archive

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


On Mon, Apr 7, 2014 at 9:21 AM, Kevin Martin <kev82@khn.org.uk> wrote:
> First thought is to run the two bits of code in two separate threads in the same state. If not I would look into LuaProxy. It lets you access variables in one state through a userdata in another. The userdata acts like the global table of the other state I think.

That's interesting, first time I heard of LuaProxy. But my first
thought is also to use a coroutine scheduler.

For true concurrency, Lanes is a good first answer, since Asko/Benoit
go to a lot of trouble to marshall Lua data across states - e.g. Lanes
copies over upvalues as well as the function code.

It's a share-nothing scheme with message passing, which is a popular
approach - a lot of people have realized that all that locking stuff
(a) is unnecessarily hard and (b) can hurt performance.