[cpp-threads] Yet another visibility question

Herb Sutter hsutter at microsoft.com
Sat Jan 13 22:54:40 GMT 2007


Paul wrote:
> Do we all agree that the only reason for using something like atomic<>
> is to -increase- performance?

A common reason to use something like atomic<> instead of a lock is to avoid the potential for a program to deadlock -- with itself (i.e., for basic correctness) or especially with separately authored parts (i.e., for composability). Note that this applies to all complex and/or composed code that has mutable shared state, not just performance-sensitive code.

Herb




More information about the cpp-threads mailing list