[fpc-devel] volatile variables

Andrew Brunner andrew.t.brunner at gmail.com
Tue Jun 28 16:15:06 CEST 2011


On Tue, Jun 28, 2011 at 9:00 AM, Henry Vermaak <henry.vermaak at gmail.com> wrote:
> On 28/06/11 14:23, Andrew Brunner wrote:
>>
>> There is no problem no need for volatile variables.  Compare and Swap
>> or Interlocked mechanisms will solve any problems.
>
> Nope.  You still need to prevent the cpu from reordering instructions with
> memory barriers.  I'm starting to sound like a broken record.  If you don't
> understand this, use the threading primitives provided by your operating
> system like everyone else.
>
> Henry

You've got your list particiapants mixed up.  It was me who suggested
order is important (at least on the lazarus discussion).

And I am am 100% correct.  Interlocked / CAS happen in one shot.  They
don't need barriers.  They are protected.
I think you have my conversations mixed up.



More information about the fpc-devel mailing list