On 07/26/2013 05:13 PM, Andi Kleen wrote:
Andrew MacLeod <amacl...@redhat.com> writes:
The way the standard is defined, any implicit operation like that is
seq_cst.  If you want something other than seq-cst, you have to
explicitly call atomic_store (&x, 0, model).
Thanks.

This doesn't sound like a good default for x86. seq_cst requires
somewhat expensive extra barriers that most people most likely don't
need.

Its the only truly safe default for a multi-threaded environment.

These are the same defaults you get with C++11 as well if you don't explicitly use a memory model in your atomic operations:
ie
 __int_type  load(memory_order __m = memory_order_seq_cst) const noexcept

So if you don't want seq-cst, you need to specify exactly what you do want.


Andrew



Reply via email to