[Lazarus] IUnknown and reference counting
Joao Morais
jcmoraisjr at gmail.com
Thu Mar 21 22:19:41 CET 2013
2013/3/21 Hans-Peter Diettrich <DrDiettrich1 at aol.com>:
> Joao Morais schrieb:
>
>> 2013/3/21 Hans-Peter Diettrich <DrDiettrich1 at aol.com>:
>>>
>>> The same considerations apply to the use of object and interface
>>> references
>>> in threads. Interface methods are implemented by class methods, and
>>> consequently must not be called from multiple threads at the same time.
>>
>> What's the problem calling the same method, even on the same object,
>> at the same time from more than one thread?
>
> Then either call can interrupt the other one, with unpredictable results.
Could you clarify?
> Calling different methods can have the same effect, when e.g. one thread
> tries to add an entry to a list, and another one to remove an entry.
Fully agree, therefore exist TThreadList and the like. These are
foreseeable scenarios when shared and sensitive data are touched and
need to be managed in a thread safe way.
No problem *calling* the same method from several threads at the same
time, afaics.
Joao Morais
More information about the Lazarus
mailing list