[Lazarus] IUnknown and reference counting

Sven Barth pascaldragon at googlemail.com
Thu Mar 21 15:59:40 CET 2013


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.

Regards,
Sven




More information about the Lazarus mailing list