lua-users home
lua-l archive

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




Am 29.06.22 um 10:23 schrieb Oliver:


On 29.06.22 10:12, Marc H. Balmer wrote:
Am 29.06.22 um 10:03 schrieb Oliver:
On 29.06.22 09:55, Marc H. Balmer wrote:
      https://github.com/osch/lua-mtstates
There is also mqLua, https://github.com/arcapos/mqlua
As far as I understand, mqLua ties the state to a thread whereas mtstates allows
the state to be called from any thread. Or am I misunderstanding something?

No, you do not.  It isolates the state, communication is done using 0MQ (i.e.
there is no locking atm).

One could interpret a mtstates object as an heavy weight stateful object that
can be passed to other threads by id (also using ZeroMQ or other multi threading
and message passing solutions) as long as the other threads are living in the
same process. It depends on the surrounding usage and implementation if than
there are two concurrently running threads accessing the same mtstates object at
the same time (and therefore producing lock-and-wait scenario) or not.

Isn't calling into the same state from different times dangerous, even if you do proper locking? With proper locking I mean every call of the C API must first obtain a lock, to prevent corrupting the stack, right?