[cpp-threads] Alternatives to SC

Peter Dimov pdimov at mmltd.net
Sat Jan 13 21:49:25 GMT 2007


Herb Sutter wrote:

> So now let me cast the question this way, which I think finally puts
> the finger on what's been bothering me:
>
>   Is an atomic variable a monitor?
>
> Or equivalently:
>
>   Does an atomic variable have internally-locked semantics?

This is precisely one of the things that has been bothering me, but possibly 
not in the same way. In another formulation, the question is:

If an atomic variable is equivalent (even performance-wise) to an ordinary 
variable protected by a lock, why do we need such atomic variables at all? 




More information about the cpp-threads mailing list