[concurrency-interest] AQS.compareAndSetHead CAS abbreviation

DT dt at flyingtroika.com
Wed Dec 31 16:37:58 EST 2014

Folks, thank you for the clarification.

> On Dec 31, 2014, at 8:44 AM, Oleksandr Otenko <oleksandr.otenko at oracle.com> wrote:
> Setting or Swapping is the same in this case - upon successful CAS(x, expected, new) you can tell that the value of x was expected, and now set to new. The meaning of swap is that the underlying instruction set may permit to load the value of x on failure - that is, if x is not expected, tell what it really is; swapping in this case refers to swapping the value of register holding expected value for the actual value.
> Alex
>> On 31/12/2014 00:39, DT wrote:
>> In the AQS class method compareAndSetHead has java doc : /* CAS head field ... */ does it mean compare and set or compare and swap?
>> It calls unsafe.compareAndSwapObject
>> Thanks

More information about the Concurrency-interest mailing list