[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Object "Forwarding" Between States
- From: Oliver <oschmidt-mailinglists@...>
- Date: Wed, 29 Jun 2022 10:43:42 +0200
On 29.06.22 10:38, Oliver wrote:
> On 29.06.22 10:31, Marc H. Balmer wrote:
>> 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?
> Yes of course. A mtstates object is something like an Java object with
> synchronized method(s).
Just to clarify, perhaps I was misunderstanding something:
>> proper locking? With proper locking I mean every call of the C API must
>> first obtain a lock, to prevent corrupting the stack, right?
It is not every call to the C API that needs a lock. It is only the call of the
mtstates object, see methods state:call() and state:tcall() in the
With this it is IMHO not dangerous to call the state from any thread.
Synchronizing the access and passing the mtstates object id to other threads has
to be done by other solutione, see e.g. the usage of mtmsg in the second