[cpp-threads] Yet another visibility question

Paul E. McKenney paulmck at linux.vnet.ibm.com
Sun Jan 14 02:44:22 GMT 2007


On Sat, Jan 13, 2007 at 02:54:40PM -0800, Herb Sutter wrote:
> 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.

Removing deadlock would certainly increase performance, wouldn't it?

Nevertheless, I can accept this as a distinction.

Do you have examples of situations requiring deadlocks to be removed
that are harmed by CCCC (as opposed to SC) atomics?

							Thanx, Paul



More information about the cpp-threads mailing list