[cpp-threads] Weak vs Strong Atomics

Lawrence Crowl Lawrence at Crowl.org
Tue May 8 22:39:28 BST 2007


On 5/8/07, Anthony Williams <anthony at justsoftwaresolutions.co.uk> wrote:
> "Lawrence Crowl" <Lawrence at Crowl.org> writes:
> > What problem are you trying to solve?  Are you trying to prevent a
> > weak view from interfering with a strong view?  Are you trying to
> > enforce a coding guideline?
>
> I am trying to enforce a coding guideline, with an eye to ensuring that the
> "strong view" is upheld. If there is code that uses strong atomics exclusively
> it's easier to think about (that is why everyone likes SC, after all). If some
> operations are weak, then you have to think about where they become visible,
> and so forth at a much more detailed level. I want it to be clearly flagged
> "this variable is a weak atomic, and you have to use it carefully". Allowing
> for conversions either way is potentially problematic in this regard.

No one has yet objected to the assertion that if your code only uses
strong operations, then you don't need to worry about someone else's
code using weak operations.

Given that, enforcing a coding guideline that says "be strong" can be
done on a per-operation basis rather than a per-type basis.  Correct?

-- 
Lawrence Crowl



More information about the cpp-threads mailing list