This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add atomic type qualifier


On 07/26/2013 05:13 PM, Andi Kleen wrote:
Andrew MacLeod <amacleod@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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]