On 08/11/2016 04:34 AM, Martin Buchholz wrote: > Again, no spec changes, but larger than expected. > > http://cr.openjdk.java.net/~martin/webrevs/openjdk9/jsr166-jdk9-integration/
Why doesn't AtomicBoolean.getAndSet use VarHandle.getAndSet, which is hopefully intrinsified completely? I like the single-CAS version too, but it probably warrants some explanation. Suggestion: "Since there are only two boolean values, single CAS is enough, because there are only two possibilities: a) CAS succeeds: the actual value needed change, and therefore it was a complement of new value; b) CAS fails: the actual value was exactly the new value." Any benchmarks backing up this optimization? Thanks, -Aleksey