[cpp-threads] Alternatives to SC

Peter Dimov pdimov at mmltd.net
Sat Jan 13 23:36:43 GMT 2007


Herb Sutter wrote:
> Peter wrote:

>> 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?
> 
> Because it's not as expensive as a lock, especially if you're just
> doing reads. For example, DCL is still a performance win. Right?

Depends on whether SC reads need to use CAS.



More information about the cpp-threads mailing list