[jmm-dev] weakCompareAndSet memory semantics

Andrew Haley aph at redhat.com
Fri Apr 22 15:24:48 UTC 2016


On 04/22/2016 02:52 PM, David M. Lloyd wrote:
> I think it boils down to this: it's likely to be slightly faster in some 
> situations.  If it's not there, someone is going to ask for it, because 
> they will want that slight bump, and it's in both C++ and C.  It seems 
> trivial to implement.  So why *not* have it?

There's also the case where you have a highly-contended counter --
think profiling -- and you want to increment it, you can't tolerate
much of a delay.  It's a disaster if that counter goes backwards but
failing to increment it at a time of high contention is not so bad.
So you try it once and continue.

Andrew.


More information about the jmm-dev mailing list