[cpp-threads] Re: Weak vs Strong Atomics

Herb Sutter hsutter at microsoft.com
Sat May 5 00:16:01 BST 2007


Lawrence wrote:
> So, grepping for function calls would satisfy your concerns?
>
> Herb, would that work for you?

In all the discussions, let me make sure of my understanding of what "that" is exactly. :-)

My understanding of the previous/extant proposal was that it provides:

  (A) one (pseudo)template atomic<T> having that has operators and CAS and whose semantics are fully SC

  (B) nonmember nonoperator functions with names like fetch_add_unordered (or _raw or _relaxed) that provide specific non-SC orderings (and as of Portland I had thought we were still putting these in a subnamespace inside std)

  (C) no explicit fences in the API, IIRC

My understanding of where we got to in Oxford was to provide:

  (A) same as above

  (B') one (pseudo)template weak_atomic<T> (or some similar name) that has everything atomic<T> has with the same semantics, plus named member functions corresponding to (B) above where they were nonmembers (so that weak_atomic<T> has an interface and semantics that are a strict supserset of atomic<T>)

  (possible C') and weak_atomic<T> might also get some member functions to express fences, this point still tbd

In B', we also had inheritance between weak_atomic<T> and atomic<T>. By "that" above, are you referring to replacing a subtype relationship with named conversion functions? If so, I think that works for me, and I always like something that's greppable.

Herb




More information about the cpp-threads mailing list