[cfe-commits] [libcxx] r154508 - /libcxx/trunk/include/atomic
Howard Hinnant
hhinnant at apple.com
Wed Apr 11 11:03:46 PDT 2012
On Apr 11, 2012, at 1:59 PM, David Chisnall wrote:
> On 11 Apr 2012, at 18:32, Howard Hinnant wrote:
>
>>> - /*constexpr*/ __atomic_base(_Tp __d) { __atomic_store(&__a_, __d, memory_order_seq_cst); }
>>> + /*constexpr*/ __atomic_base(_Tp __d) : __a_(__d) {}
>>
>> What is the reason that __atomic_init is not needed here? Is this now not an atomic store?
>>> - atomic_flag(bool __b) { __atomic_store(&__a_, __b, memory_order_seq_cst); }
>>> + atomic_flag(bool __b) : __a_(__b) {}
>>
>> and here?
>
> Initialisation of an _Atomic() value is not an atomic operation in C11. Clang now understands that the C++ syntax for initialisation should have the same semantics. Short version:
>
> _Atomic(int) i = j; // Non-atomic store
> i = k; // Sequentially consistent atomic store
> __atomic_store(&i, k, whatever) // Atomic store with whatever ordering
> __atomic_init(&i, j); // Non-atomic store
>
> David
Ok, thanks.
Howard
More information about the cfe-commits
mailing list