Provides an object reference that may be updated and read atomically. More...
Public Member Functions | |
AtomicReference () | |
Creates a new AtomicReference instance where the contained value is default to null. More... | |
AtomicReference (T value) | |
Creates a new AtomicReference instance where the contained value is set to the provided value. More... | |
T | Get () |
Atomic read of the contained value. More... | |
void | Set (T target) |
Atomic write of the given value into the contained object reference. More... | |
bool | CompareAndSet (T expectedValue, T newValue) |
Atomically set the value to the new value if and only if the value that is currently set matches the target expected value. More... | |
T | CompareAndExchange (T expectedValue, T newValue) |
Compare the current value to the expected value and if they match set the current value to the new value as an atomic operation. More... | |
override string | ToString () |
Performs a to string operation on the currently set value. More... | |
Static Public Member Functions | |
static implicit | operator T (AtomicReference< T > reference) |
Implicit conversion of an atomic reference type to the contained value using a volatile read operation. More... | |
Properties | |
T | Value [get, set] |
Atomic access to the contained value. More... | |
Provides an object reference that may be updated and read atomically.
T | : | class |
|
inline |
Creates a new AtomicReference instance where the contained value is default to null.
|
inline |
Creates a new AtomicReference instance where the contained value is set to the provided value.
value | The value to initialize the reference with |
|
inline |
Compare the current value to the expected value and if they match set the current value to the new value as an atomic operation.
expectedValue | the value that must currently be set |
newValue | the value to set if the current value matches the expectation |
|
inline |
Atomically set the value to the new value if and only if the value that is currently set matches the target expected value.
expectedValue | The value that is required before the new value is applied |
newValue | The new value to set if the current value matches the expectation |
|
inline |
Atomic read of the contained value.
|
inlinestatic |
Implicit conversion of an atomic reference type to the contained value using a volatile read operation.
reference | The atomic reference to read from |
|
inline |
Atomic write of the given value into the contained object reference.
target | The object reference value to set. |
|
inline |
Performs a to string operation on the currently set value.
|
getset |
Atomic access to the contained value.