[fpc-devel] Suggestion: reference counted objects

Boian Mitov mitov at mitov.com
Sun Sep 21 06:08:19 CEST 2014

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 
Indeed that is how it works in Delphi, and BTW: that is how Strings work in 
Delphi and FPC the last time I checked ;-) .

With best regards,
Boian Mitov

Mitov Software
-----Original Message----- 
From: Hans-Peter Diettrich
Sent: Saturday, September 20, 2014 8:34 PM
To: FPC developers' list
Subject: Re: [fpc-devel] Suggestion: reference counted objects

Sven Barth schrieb:
> Am 20.09.2014 20:34 schrieb "Giuliano Colla"

As I understand Interlocked Inc/Dec funtionality, it only protects the
update of the reference counter against interrupts, but not the tests
required before/after this update. As a precaution a RefCount should at
least be incremented as soon as there exists a *chance*, that the
reference is used/copied in some piece of currently active code (thread...).


fpc-devel maillist  -  fpc-devel at lists.freepascal.org

More information about the fpc-devel mailing list