On 05/15/2018 11:01 AM, Rodrigo V. G. wrote:
> I tried to use __atomic_fetch_add in C++ with a volatile (non _Atomic) 
> variable,
> and it seems to generate the same assembler code.
> The only difference that I saw was that with _Atomic
> it generates a "mfence" instruction after initialization but with
> volatile it does not.

That's what should happen on x86.

> So I think it might not provide the same guarantees.

I think it does.

-- 
Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671

Reply via email to