Subject: Re: [boost] [atomic, x86] need another pair of eyes
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2012-12-19 11:41:35
On Wed, Dec 19, 2012 at 4:28 PM, Peter Dimov <lists_at_[hidden]> wrote:
> Andrey Semashev wrote:
>> > All uses of READ_BARRIER or WRITE_BARRIER seem wrong, though.
>> > READ_WRITE_BARRIER is needed in all places where these are used.
>> Why? The intention was to prevent outer reads and writes being
>> reordered with the atomic op. Did I miss something?
> The acquire/release semantics are not specific to reads or writes. An
> acquire load should prevent subsequent writes from being reordered so as to
> precede it, and a read barrier doesn't do that, I think.
I suppose you're right. I was under impression that _ReadBarrier and
_WriteBarrier intrinsics were equivalent to the acquire and release
compiler fences but reading their docs now this doesn't seem to be
correct. Only _ReadWriteBarrier has the comment that the compiler
doesn't reorder operations across it. Thank you, I will correct the
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk