Methods Summary |
---|
public final boolean | compareAndSet(V expect, V update)Atomically set the value to the given updated value
if the current value == the expected value.
return unsafe.compareAndSwapObject(this, valueOffset, expect, update);
|
public final V | get()Get the current value.
return value;
|
public final V | getAndSet(V newValue)Set to the given value and return the old value.
while (true) {
V x = get();
if (compareAndSet(x, newValue))
return x;
}
|
public final void | set(V newValue)Set to the given value.
value = newValue;
|
public java.lang.String | toString()Returns the String representation of the current value.
return String.valueOf(get());
|
public final boolean | weakCompareAndSet(V expect, V update)Atomically set the value to the given updated value
if the current value == the expected value.
May fail spuriously.
return unsafe.compareAndSwapObject(this, valueOffset, expect, update);
|