[concurrency-interest] AtomicReference.updateAndGet() mandatory updating

Andrew Haley aph at redhat.com
Wed May 24 04:23:15 EDT 2017


On 24/05/17 00:58, Mike Duigou wrote:
> I find that I write a lot of update functions which only occasionally 
> change the value. For these cases I wonder if it would be reasonable to 
> skip the update if the value of next is unchanged from previous. 

I don't think so, because the update has the effect of a volatile
write.  If you skip the update you lose the happens-before ordering
of that write.

Andrew.


More information about the Concurrency-interest mailing list