[fpc-pascal] Getting the state of a TRTLCriticalSection
Mark Morgan Lloyd
markMLl.fpc-pascal at telemetry.co.uk
Mon Oct 7 11:40:33 CEST 2013
Jonas Maebe wrote:
> 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.
Thanks Jonas, noted. For completeness, is there a way to force one?
--
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