lua-users home
lua-l archive

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


On 01/03/2015 02:58 PM, Anton Titov wrote:
> Also this kind of concurrency, you are proposing will have many problems. For
> example this code will now yield unpredictable results if the variable "a" is
> shared:
> a=a+1;
> t[a]=newval;

That is intended

> I don't exactly know what is Lanes' approach to multi threading, but I would
> start different threads with different Lua states. Inside them I would have an
> userdata value that behaves like a table with accesses to all fields would be
> serialized and shared between all threads. Of course in this case you will have
> to copy the values on every access from your own representation to Lua. Atomic
> add/subtract will be necessary. The same goes for explicit lock/unlock as in
> some cases you just want to have an atomic transaction involving multiple
> variables.

That's more or less what Lanes does and that sounds like a totally silly idea to me.


-- 
/* mniip */