Does a compare-and-set operation on the current value.
Does a compare-and-set operation on the current value. For more info, checkout the related Compare-and-swap Wikipedia page.
It's an atomic, worry free operation.
is the value you expect to be persisted when the operation happens
will be the new value, should the check for expect
succeeds
either true in case the operation succeeded or false otherwise
Get the current value persisted by this Atomic.
Sets the persisted value to update
and returns the old value that was in place.
Sets the persisted value to update
and returns the old value that was in place.
It's an atomic, worry free operation.
Eventually sets to the given value.
Eventually sets to the given value.
Has weaker visibility guarantees than the normal set()
.
Updates the current value.
Updates the current value.
will be the new value returned by get()
Alias for set.
Alias for set. Updates the current value.
will be the new value returned by get()
Get the current value persisted by this Atomic, an alias for get()
.
Abstracts over compareAndSet
.
Abstracts over compareAndSet
. You specify a transformation by specifying a callback to be
executed, a callback that transforms the current value. This method will loop until it will
succeed in replacing the current value with the one produced by the given callback.
Note that the callback will be executed on each iteration of the loop, so it can be called multiple times - don't do destructive I/O or operations that mutate global state in it.
is a callback that receives the current value as input and returns the update
which is the
new value that should be persisted
the old value, just prior to when the successful update happened
Abstracts over compareAndSet
.
Abstracts over compareAndSet
. You specify a transformation by specifying a callback to be
executed, a callback that transforms the current value. This method will loop until it will
succeed in replacing the current value with the one produced by the given callback.
Note that the callback will be executed on each iteration of the loop, so it can be called multiple times - don't do destructive I/O or operations that mutate global state in it.
is a callback that receives the current value as input and returns the update
which is the
new value that should be persisted
Abstracts over compareAndSet
.
Abstracts over compareAndSet
. You specify a transformation by specifying a callback to be
executed, a callback that transforms the current value. This method will loop until it will
succeed in replacing the current value with the one produced by your callback.
Note that the callback will be executed on each iteration of the loop, so it can be called multiple times - don't do destructive I/O or operations that mutate global state in it.
is a callback that receives the current value as input and returns a tuple that specifies the update + what should this method return when the operation succeeds.
whatever was specified by your callback, once the operation succeeds
Abstracts over compareAndSet
.
Abstracts over compareAndSet
. You specify a transformation by specifying a callback to be
executed, a callback that transforms the current value. This method will loop until it will
succeed in replacing the current value with the one produced by the given callback.
Note that the callback will be executed on each iteration of the loop, so it can be called multiple times - don't do destructive I/O or operations that mutate global state in it.
is a callback that receives the current value as input and returns the update
which is the
new value that should be persisted
whatever the update is, after the operation succeeds
Alias for set.
Alias for set. Updates the current value.
will be the new value returned by get()
Base trait of all atomic references, no matter the type.