[fpc-pascal] Getting the state of a TRTLCriticalSection

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Oct 7 11:50:35 CEST 2013


On 07 Oct 2013, at 11:33, Marco van de Voort wrote:

> In our previous episode, Jonas Maebe said:
>>> [interlocked increment/decrement]
>> They do not include any memory barrier. The only thing those routines
>> guarantee on all platforms, is that the value is atomically
>> incremented/decremented.
>
> (btw that depends on which functions you mean, our own assembler  
> versions
> probably.
>
> The Windows
> functions of the same name are guaranteed to have memory barriers  
> afaik,
> but do require alignment. (probably to avoid crosssing cache lines)
> )

That's why I wrote "on all platforms". They also always require a  
native alignment on all platforms, because those are cpu limitations  
for atomic instructions.


On 07 Oct 2013, at 11:40, Mark Morgan Lloyd wrote:

> Thanks Jonas, noted. For completeness, is there a way to force one?

See http://www.freepascal.org/docs-html/rtl/system/ 
readwritebarrier.html and the pages linked from there.


Jonas



More information about the fpc-pascal mailing list