[fpc-pascal] Getting the state of a TRTLCriticalSection

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


On 07 Oct 2013, at 09:14, Mark Morgan Lloyd wrote:

> Benito van der Zander wrote:
>>>
>>> In the end I stuck in code to increment/decrement a counter, and  
>>> looked for it to be explicitly 0 or 1.
>> Do you need to put a memory barrier around that, or does the  
>> critical section take care of that?
>
> I used the interlocked increment/decrement, which- as I understand  
> it- should handle membar itself on architectures that can benefit  
> from it.

They do not include any memory barrier. The only thing those routines  
guarantee on all platforms, is that the value is atomically  
incremented/decremented.


Jonas



More information about the fpc-pascal mailing list