Boost logo

Boost :

Subject: Re: [boost] [atomic] Probable documentation issue: how do weknowatomic is safe and/or efficient?
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2014-01-26 12:29:27


On Wed, Dec 25, 2013 at 4:47 PM, Andrey Semashev
<andrey.semashev_at_[hidden]> wrote:
> On Wed, Dec 25, 2013 at 4:40 PM, Rob Stewart <robertstewart_at_[hidden]> wrote:
>> On Dec 24, 2013, at 2:24 PM, Andrey Semashev <andrey.semashev_at_[hidden]> wrote:
>>
>>> On Tuesday 24 December 2013 17:17:37 John Maddock wrote:
>>>>>> I'm sure the answer to (a) is that it is correct, but I was surprised that atomic<int> relied on the volatile modifier for thread safe load/stores on MSVC, I had assumed that something more than that would have been required, but I know I'm out of date on this stuff!
>>>>>
>>>>> "volatile" was changed in VC++ 8.0 to guarantee acquire/release semantics,
>>>>> then changed back in 2012 to only do so when /volatile:ms is active, which it is by default, except on ARM.
>>>>>
>>>>> http://msdn.microsoft.com/en-us/library/12a04hfd.aspx
>>>>
>>>> So does this mean that Boost.Atomic is perhaps not safe after all?
>>>
>>> No, it's perfectly safe on x86. It is also safe on ARM if /volatile:ms is specified.
>>
>> How do you ensure the use of /volatile:ms? Can users build Boost with /volatile:iso?
>
> You can't, I was just answering John's question.
>
> To be clear, yes, I agree that this needs fixing. It's just no one got
> around to do it. A ticket would be welcome. Especially, with a patch.
> :)

I have updated Boost.Atomic (develop branch) so that it should work on
Windows ARM, but I don't have hardware to test it. To my knowledge,
none of our testers have the hardware as well. So I would appreciate
if someone tried it out and reported the results (both positive and
negative). Thanks.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk