Class InterlockedSpin
INTERNAL!
Implements helpers for performing Compare-and-swap operations using CompareExchange<T>(T, T, T)
Inherited Members
Namespace: Akka.Util.Internal
Assembly: Akka.dll
Syntax
public static class InterlockedSpin
Methods
| Improve this Doc View SourceConditionallySwap<T, TReturn>(ref T, Func<T, (Boolean, T, TReturn)>)
INTERNAL!
Atomically updates the int reference
by calling updateIfTrue
to get the new value.
updateIfTrue
returns a ValueTuple<should update, the new int value, the return value>
If the first item in the tuple is true, the value is updated, and the third value of the tuple is returned.
Note that updateIfTrue
may be called many times so it should be idempotent.
Declaration
public static TReturn ConditionallySwap<T, TReturn>(ref T reference, Func<T, (bool, T, TReturn)> updateIfTrue)
where T : class
Parameters
Type | Name | Description |
---|---|---|
T | reference | TBD |
Func<T, System.ValueTuple<Boolean, T, TReturn>> | updateIfTrue | TBD |
Returns
Type | Description |
---|---|
TReturn | The third value from the tuple return by |
Type Parameters
Name | Description |
---|---|
T | TBD |
TReturn | TBD |
Swap<T>(ref T, Func<T, T>)
INTERNAL!
Atomically updates the object reference
by calling updater
to get the new value.
Note that updater
may be called many times so it should be idempotent.
Declaration
public static T Swap<T>(ref T reference, Func<T, T> updater)
where T : class
Parameters
Type | Name | Description |
---|---|---|
T | reference | TBD |
Func<T, T> | updater | TBD |
Returns
Type | Description |
---|---|
T | The updated value. |
Type Parameters
Name | Description |
---|---|
T | TBD |