acquire/release versions of CAS/RMW operations

Alexey Egorov electreg at list.ru
Wed Nov 15 20:22:08 UTC 2023


Documentation for VarHandle.compareAndExchangeRelease says that memory effects of reading value of this variable is the same as the effects for plain read.
Does that mean that returned value is not usable in a CAS loop if there is no other memory effects in-between iterations? Because in theory it is possible for plain read to return the same value on every iteration of this loop.
And if so - wouldn’t it be more useful to have a versions of CAS operation with getOpaque/setRelease and setOpaque/getAcquire effects?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jdk-dev/attachments/20231115/819a0727/attachment.htm>


More information about the jdk-dev mailing list