[fpc-pascal] Inclocked/declocked
Mark Morgan Lloyd
markMLl.fpc-pascal at telemetry.co.uk
Tue Sep 12 10:37:34 CEST 2017
On 11/09/17 19:45, Sven Barth via fpc-pascal wrote:
> I've rechecked and the thing is as follows:- the IncLocked call happens each time you assign a dynamic array toanother dynamic array variable or a by-value parameter (this alsoincludes being part of a record, but not a class instance or TP-styleobject)- the DecLocked call happens each time the array is cleared (as long asthe reference count is > 0 this only means a decrement of the count)which happens if you assign Nil, assign a different array (thedestination array is "cleared") or if the array variable goes out of scope
> The two routines are also used in context of Ansi- and UnicodeStringvariables as well as reference counted interfaces (aka COM-styleinterfaces).
> In contrast to what I wrote earlier the compiler does however not ensurea unique array if you only change an element, so given the followingexample:
In the general case, will these force a membar or a cache flush?
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
More information about the fpc-pascal
mailing list