Am 21.03.2013 18:58 schrieb "Hans-Peter Diettrich" <[email protected]>:
>
> Sven Barth schrieb:
>
>> Am 21.03.2013 15:22, schrieb Kostas Michalopoulos:
>>>
>>> What i'm thinking right now is to simply create the lightmap objects
(as interfaces) from the lightmapper side and send them to the 3D world
side. My only concern for now is if interfaces are thread safe (that is,
what happens if two threads keep a reference for the same object) or i need
to do my own locking.
>>
>> "TInterfacedObject" uses "InterlockedIncrement" and
"InterlockedDecrement" to manage the reference count. So on platforms where
these two are implemented in a thread safe manner it should be safe to use
interfaces in multiple threads.
>
>
> No :-(
>
> 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.

Kostas did not write about calling methods, but keeping references. And
here the reference counting mechanism can be considered threadsafe.

Regards,
Sven
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to