|
Boost : |
Subject: Re: [boost] [lockfree] review
From: Gottlob Frege (gottlobfrege_at_[hidden])
Date: 2011-08-27 22:20:20
On Sat, Aug 27, 2011 at 1:52 PM, Dave Abrahams <dave_at_[hidden]> wrote:
>
> on Sat Aug 27 2011, Gottlob Frege <gottlobfrege-AT-gmail.com> wrote:
>
>> There is no "synchronizes with" (standard's wording) because
>> synch-with requires thread 2 to *read* the value written into the
>> atomic by thread 1. We have no reads here - no if statement - so
>> reordering doesn't matter.
>> I don't think the standard disallows the reordering of i and j, even
>> if they are atomics.
>
> IIUC from the point of view of programs without undefined behavior, the
> standard disallows reordering in both cases.
>
> --
> Dave Abrahams
> BoostPro Computing
> http://www.boostpro.com
>
But without a read, there is no visible behaviour. There is probably
no such thing as "reordering" in the standard. Just whether a second
thread reads what a first thread wrote, and if it does, what can be
assumed by that (you can assume synch-with, if you follow the rules).
I guess I haven't read very closely the SC parts of the standard,
where it talks about data races. I concentrated on the synch-with
parts.
Maybe we need a better example?
Tony
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk