[fpc-devel] Suggestion: reference counted objects

Florian Klämpfl florian at freepascal.org
Sun Sep 21 10:43:00 CEST 2014


Am 21.09.2014 um 07:22 schrieb Hans-Peter Diettrich:
> Boian Mitov schrieb:
>> That is easy. it gets incremented when it gets assigned. The running threads have no way of
>> accessing it if there is no reference (assignment) already in place.
> 
> The problem arises when an object is destroyed, or even elected for destruction in _Release, while
> another thread starts using the same instance.

This is not possible for a correctly written program: if two threads having references to the same
instance, the ref. count is 2. So no destruction is possible.




More information about the fpc-devel mailing list