Class Atomic
Exposes atomic operations for thread-safe scenarios.
Inherited Members
Namespace: DotNext.Threading
Assembly: DotNext.dll
Syntax
public static class Atomic
Methods
| Edit this page View SourceAccumulateAndGet(ref double, double, Func<double, double, double>)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.
Declaration
public static double AccumulateAndGet(ref double value, double x, Func<double, double, double> accumulator)
Parameters
Type | Name | Description |
---|---|---|
double | value | Reference to a value to be modified. |
double | x | Accumulator operand. |
Func<double, double, double> | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
double | The updated value. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
AccumulateAndGet(ref int, int, Func<int, int, int>)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.
Declaration
public static int AccumulateAndGet(ref int value, int x, Func<int, int, int> accumulator)
Parameters
Type | Name | Description |
---|---|---|
int | value | Reference to a value to be modified. |
int | x | Accumulator operand. |
Func<int, int, int> | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
int | The updated value. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
AccumulateAndGet(ref long, long, Func<long, long, long>)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.
Declaration
public static long AccumulateAndGet(ref long value, long x, Func<long, long, long> accumulator)
Parameters
Type | Name | Description |
---|---|---|
long | value | Reference to a value to be modified. |
long | x | Accumulator operand. |
Func<long, long, long> | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
long | The updated value. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
AccumulateAndGet(ref nint, nint, Func<nint, nint, nint>)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.
Declaration
public static nint AccumulateAndGet(ref nint value, nint x, Func<nint, nint, nint> accumulator)
Parameters
Type | Name | Description |
---|---|---|
nint | value | Reference to a value to be modified. |
nint | x | Accumulator operand. |
Func<nint, nint, nint> | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
nint | The updated value. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
AccumulateAndGet(ref float, float, Func<float, float, float>)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.
Declaration
public static float AccumulateAndGet(ref float value, float x, Func<float, float, float> accumulator)
Parameters
Type | Name | Description |
---|---|---|
float | value | Reference to a value to be modified. |
float | x | Accumulator operand. |
Func<float, float, float> | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
float | The updated value. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
AccumulateAndGet(ref uint, uint, Func<uint, uint, uint>)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.
Declaration
[CLSCompliant(false)]
public static uint AccumulateAndGet(ref uint value, uint x, Func<uint, uint, uint> accumulator)
Parameters
Type | Name | Description |
---|---|---|
uint | value | Reference to a value to be modified. |
uint | x | Accumulator operand. |
Func<uint, uint, uint> | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
uint | The updated value. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
AccumulateAndGet(ref ulong, ulong, Func<ulong, ulong, ulong>)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.
Declaration
[CLSCompliant(false)]
public static ulong AccumulateAndGet(ref ulong value, ulong x, Func<ulong, ulong, ulong> accumulator)
Parameters
Type | Name | Description |
---|---|---|
ulong | value | Reference to a value to be modified. |
ulong | x | Accumulator operand. |
Func<ulong, ulong, ulong> | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
ulong | The updated value. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
AccumulateAndGet(ref nuint, nuint, Func<nuint, nuint, nuint>)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.
Declaration
[CLSCompliant(false)]
public static nuint AccumulateAndGet(ref nuint value, nuint x, Func<nuint, nuint, nuint> accumulator)
Parameters
Type | Name | Description |
---|---|---|
nuint | value | Reference to a value to be modified. |
nuint | x | Accumulator operand. |
Func<nuint, nuint, nuint> | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
nuint | The updated value. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
AccumulateAndGet<TAccumulator>(ref double, double, TAccumulator)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.
Declaration
public static double AccumulateAndGet<TAccumulator>(ref double value, double x, TAccumulator accumulator) where TAccumulator : notnull, ISupplier<double, double, double>
Parameters
Type | Name | Description |
---|---|---|
double | value | Reference to a value to be modified. |
double | x | Accumulator operand. |
TAccumulator | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
double | The updated value. |
Type Parameters
Name | Description |
---|---|
TAccumulator | The type implementing accumulator. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
AccumulateAndGet<TAccumulator>(ref int, int, TAccumulator)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.
Declaration
public static int AccumulateAndGet<TAccumulator>(ref int value, int x, TAccumulator accumulator) where TAccumulator : notnull, ISupplier<int, int, int>
Parameters
Type | Name | Description |
---|---|---|
int | value | Reference to a value to be modified. |
int | x | Accumulator operand. |
TAccumulator | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
int | The updated value. |
Type Parameters
Name | Description |
---|---|
TAccumulator | The type implementing accumulator. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
AccumulateAndGet<TAccumulator>(ref long, long, TAccumulator)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.
Declaration
public static long AccumulateAndGet<TAccumulator>(ref long value, long x, TAccumulator accumulator) where TAccumulator : notnull, ISupplier<long, long, long>
Parameters
Type | Name | Description |
---|---|---|
long | value | Reference to a value to be modified. |
long | x | Accumulator operand. |
TAccumulator | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
long | The updated value. |
Type Parameters
Name | Description |
---|---|
TAccumulator | The type implementing accumulator. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
AccumulateAndGet<TAccumulator>(ref nint, nint, TAccumulator)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.
Declaration
public static nint AccumulateAndGet<TAccumulator>(ref nint value, nint x, TAccumulator accumulator) where TAccumulator : notnull, ISupplier<nint, nint, nint>
Parameters
Type | Name | Description |
---|---|---|
nint | value | Reference to a value to be modified. |
nint | x | Accumulator operand. |
TAccumulator | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
nint | The updated value. |
Type Parameters
Name | Description |
---|---|
TAccumulator | The type implementing accumulator. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
AccumulateAndGet<TAccumulator>(ref float, float, TAccumulator)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.
Declaration
public static float AccumulateAndGet<TAccumulator>(ref float value, float x, TAccumulator accumulator) where TAccumulator : notnull, ISupplier<float, float, float>
Parameters
Type | Name | Description |
---|---|---|
float | value | Reference to a value to be modified. |
float | x | Accumulator operand. |
TAccumulator | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
float | The updated value. |
Type Parameters
Name | Description |
---|---|
TAccumulator | The type implementing accumulator. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
AccumulateAndGet<TAccumulator>(ref uint, uint, TAccumulator)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.
Declaration
[CLSCompliant(false)]
public static uint AccumulateAndGet<TAccumulator>(ref uint value, uint x, TAccumulator accumulator) where TAccumulator : notnull, ISupplier<uint, uint, uint>
Parameters
Type | Name | Description |
---|---|---|
uint | value | Reference to a value to be modified. |
uint | x | Accumulator operand. |
TAccumulator | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
uint | The updated value. |
Type Parameters
Name | Description |
---|---|
TAccumulator | The type implementing accumulator. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
AccumulateAndGet<TAccumulator>(ref ulong, ulong, TAccumulator)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.
Declaration
[CLSCompliant(false)]
public static ulong AccumulateAndGet<TAccumulator>(ref ulong value, ulong x, TAccumulator accumulator) where TAccumulator : notnull, ISupplier<ulong, ulong, ulong>
Parameters
Type | Name | Description |
---|---|---|
ulong | value | Reference to a value to be modified. |
ulong | x | Accumulator operand. |
TAccumulator | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
ulong | The updated value. |
Type Parameters
Name | Description |
---|---|
TAccumulator | The type implementing accumulator. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
AccumulateAndGet<TAccumulator>(ref nuint, nuint, TAccumulator)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.
Declaration
[CLSCompliant(false)]
public static nuint AccumulateAndGet<TAccumulator>(ref nuint value, nuint x, TAccumulator accumulator) where TAccumulator : notnull, ISupplier<nuint, nuint, nuint>
Parameters
Type | Name | Description |
---|---|---|
nuint | value | Reference to a value to be modified. |
nuint | x | Accumulator operand. |
TAccumulator | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
nuint | The updated value. |
Type Parameters
Name | Description |
---|---|
TAccumulator | The type implementing accumulator. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
GetAndAccumulate(ref double, double, Func<double, double, double>)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the original value.
Declaration
public static double GetAndAccumulate(ref double value, double x, Func<double, double, double> accumulator)
Parameters
Type | Name | Description |
---|---|---|
double | value | Reference to a value to be modified. |
double | x | Accumulator operand. |
Func<double, double, double> | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
double | The original value. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
GetAndAccumulate(ref int, int, Func<int, int, int>)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the original value.
Declaration
public static int GetAndAccumulate(ref int value, int x, Func<int, int, int> accumulator)
Parameters
Type | Name | Description |
---|---|---|
int | value | Reference to a value to be modified. |
int | x | Accumulator operand. |
Func<int, int, int> | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
int | The original value. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
GetAndAccumulate(ref long, long, Func<long, long, long>)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the original value.
Declaration
public static long GetAndAccumulate(ref long value, long x, Func<long, long, long> accumulator)
Parameters
Type | Name | Description |
---|---|---|
long | value | Reference to a value to be modified. |
long | x | Accumulator operand. |
Func<long, long, long> | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
long | The original value. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
GetAndAccumulate(ref nint, nint, Func<nint, nint, nint>)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the original value.
Declaration
public static nint GetAndAccumulate(ref nint value, nint x, Func<nint, nint, nint> accumulator)
Parameters
Type | Name | Description |
---|---|---|
nint | value | Reference to a value to be modified. |
nint | x | Accumulator operand. |
Func<nint, nint, nint> | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
nint | The original value. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
GetAndAccumulate(ref float, float, Func<float, float, float>)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the original value.
Declaration
public static float GetAndAccumulate(ref float value, float x, Func<float, float, float> accumulator)
Parameters
Type | Name | Description |
---|---|---|
float | value | Reference to a value to be modified. |
float | x | Accumulator operand. |
Func<float, float, float> | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
float | The original value. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
GetAndAccumulate(ref uint, uint, Func<uint, uint, uint>)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the original value.
Declaration
[CLSCompliant(false)]
public static uint GetAndAccumulate(ref uint value, uint x, Func<uint, uint, uint> accumulator)
Parameters
Type | Name | Description |
---|---|---|
uint | value | Reference to a value to be modified. |
uint | x | Accumulator operand. |
Func<uint, uint, uint> | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
uint | The original value. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
GetAndAccumulate(ref ulong, ulong, Func<ulong, ulong, ulong>)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the original value.
Declaration
[CLSCompliant(false)]
public static ulong GetAndAccumulate(ref ulong value, ulong x, Func<ulong, ulong, ulong> accumulator)
Parameters
Type | Name | Description |
---|---|---|
ulong | value | Reference to a value to be modified. |
ulong | x | Accumulator operand. |
Func<ulong, ulong, ulong> | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
ulong | The original value. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
GetAndAccumulate(ref nuint, nuint, Func<nuint, nuint, nuint>)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the original value.
Declaration
[CLSCompliant(false)]
public static nuint GetAndAccumulate(ref nuint value, nuint x, Func<nuint, nuint, nuint> accumulator)
Parameters
Type | Name | Description |
---|---|---|
nuint | value | Reference to a value to be modified. |
nuint | x | Accumulator operand. |
Func<nuint, nuint, nuint> | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
nuint | The original value. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
GetAndAccumulate<TAccumulator>(ref double, double, TAccumulator)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the original value.
Declaration
public static double GetAndAccumulate<TAccumulator>(ref double value, double x, TAccumulator accumulator) where TAccumulator : notnull, ISupplier<double, double, double>
Parameters
Type | Name | Description |
---|---|---|
double | value | Reference to a value to be modified. |
double | x | Accumulator operand. |
TAccumulator | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
double | The original value. |
Type Parameters
Name | Description |
---|---|
TAccumulator | The type implementing accumulator. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
GetAndAccumulate<TAccumulator>(ref int, int, TAccumulator)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the original value.
Declaration
public static int GetAndAccumulate<TAccumulator>(ref int value, int x, TAccumulator accumulator) where TAccumulator : notnull, ISupplier<int, int, int>
Parameters
Type | Name | Description |
---|---|---|
int | value | Reference to a value to be modified. |
int | x | Accumulator operand. |
TAccumulator | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
int | The original value. |
Type Parameters
Name | Description |
---|---|
TAccumulator | The type implementing accumulator. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
GetAndAccumulate<TAccumulator>(ref long, long, TAccumulator)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the original value.
Declaration
public static long GetAndAccumulate<TAccumulator>(ref long value, long x, TAccumulator accumulator) where TAccumulator : notnull, ISupplier<long, long, long>
Parameters
Type | Name | Description |
---|---|---|
long | value | Reference to a value to be modified. |
long | x | Accumulator operand. |
TAccumulator | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
long | The original value. |
Type Parameters
Name | Description |
---|---|
TAccumulator | The type implementing accumulator. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
GetAndAccumulate<TAccumulator>(ref nint, nint, TAccumulator)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the original value.
Declaration
public static nint GetAndAccumulate<TAccumulator>(ref nint value, nint x, TAccumulator accumulator) where TAccumulator : notnull, ISupplier<nint, nint, nint>
Parameters
Type | Name | Description |
---|---|---|
nint | value | Reference to a value to be modified. |
nint | x | Accumulator operand. |
TAccumulator | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
nint | The original value. |
Type Parameters
Name | Description |
---|---|
TAccumulator | The type implementing accumulator. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
GetAndAccumulate<TAccumulator>(ref float, float, TAccumulator)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the original value.
Declaration
public static float GetAndAccumulate<TAccumulator>(ref float value, float x, TAccumulator accumulator) where TAccumulator : notnull, ISupplier<float, float, float>
Parameters
Type | Name | Description |
---|---|---|
float | value | Reference to a value to be modified. |
float | x | Accumulator operand. |
TAccumulator | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
float | The original value. |
Type Parameters
Name | Description |
---|---|
TAccumulator | The type implementing accumulator. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
GetAndAccumulate<TAccumulator>(ref uint, uint, TAccumulator)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the original value.
Declaration
[CLSCompliant(false)]
public static uint GetAndAccumulate<TAccumulator>(ref uint value, uint x, TAccumulator accumulator) where TAccumulator : notnull, ISupplier<uint, uint, uint>
Parameters
Type | Name | Description |
---|---|---|
uint | value | Reference to a value to be modified. |
uint | x | Accumulator operand. |
TAccumulator | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
uint | The original value. |
Type Parameters
Name | Description |
---|---|
TAccumulator | The type implementing accumulator. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
GetAndAccumulate<TAccumulator>(ref ulong, ulong, TAccumulator)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the original value.
Declaration
[CLSCompliant(false)]
public static ulong GetAndAccumulate<TAccumulator>(ref ulong value, ulong x, TAccumulator accumulator) where TAccumulator : notnull, ISupplier<ulong, ulong, ulong>
Parameters
Type | Name | Description |
---|---|---|
ulong | value | Reference to a value to be modified. |
ulong | x | Accumulator operand. |
TAccumulator | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
ulong | The original value. |
Type Parameters
Name | Description |
---|---|
TAccumulator | The type implementing accumulator. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
GetAndAccumulate<TAccumulator>(ref nuint, nuint, TAccumulator)
Atomically updates the current value with the results of applying the given function to the current and given values, returning the original value.
Declaration
[CLSCompliant(false)]
public static nuint GetAndAccumulate<TAccumulator>(ref nuint value, nuint x, TAccumulator accumulator) where TAccumulator : notnull, ISupplier<nuint, nuint, nuint>
Parameters
Type | Name | Description |
---|---|---|
nuint | value | Reference to a value to be modified. |
nuint | x | Accumulator operand. |
TAccumulator | accumulator | A side-effect-free function of two arguments. |
Returns
Type | Description |
---|---|
nuint | The original value. |
Type Parameters
Name | Description |
---|---|
TAccumulator | The type implementing accumulator. |
Remarks
The function is applied with the current value as its first argument, and the given update as the second argument.
GetAndUpdate(ref double, Func<double, double>)
Atomically updates the stored value with the results of applying the given function, returning the original value.
Declaration
public static double GetAndUpdate(ref double value, Func<double, double> updater)
Parameters
Type | Name | Description |
---|---|---|
double | value | Reference to a value to be modified. |
Func<double, double> | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
double | The original value. |
GetAndUpdate(ref int, Func<int, int>)
Atomically updates the stored value with the results of applying the given function, returning the original value.
Declaration
public static int GetAndUpdate(ref int value, Func<int, int> updater)
Parameters
Type | Name | Description |
---|---|---|
int | value | Reference to a value to be modified. |
Func<int, int> | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
int | The original value. |
GetAndUpdate(ref long, Func<long, long>)
Atomically updates the stored value with the results of applying the given function, returning the original value.
Declaration
public static long GetAndUpdate(ref long value, Func<long, long> updater)
Parameters
Type | Name | Description |
---|---|---|
long | value | Reference to a value to be modified. |
Func<long, long> | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
long | The original value. |
GetAndUpdate(ref nint, Func<nint, nint>)
Atomically updates the stored value with the results of applying the given function, returning the original value.
Declaration
public static nint GetAndUpdate(ref nint value, Func<nint, nint> updater)
Parameters
Type | Name | Description |
---|---|---|
nint | value | Reference to a value to be modified. |
Func<nint, nint> | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
nint | The original value. |
GetAndUpdate(ref float, Func<float, float>)
Atomically updates the stored value with the results of applying the given function, returning the original value.
Declaration
public static float GetAndUpdate(ref float value, Func<float, float> updater)
Parameters
Type | Name | Description |
---|---|---|
float | value | Reference to a value to be modified. |
Func<float, float> | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
float | The original value. |
GetAndUpdate(ref uint, Func<uint, uint>)
Atomically updates the stored value with the results of applying the given function, returning the original value.
Declaration
[CLSCompliant(false)]
public static uint GetAndUpdate(ref uint value, Func<uint, uint> updater)
Parameters
Type | Name | Description |
---|---|---|
uint | value | Reference to a value to be modified. |
Func<uint, uint> | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
uint | The original value. |
GetAndUpdate(ref ulong, Func<ulong, ulong>)
Atomically updates the stored value with the results of applying the given function, returning the original value.
Declaration
[CLSCompliant(false)]
public static ulong GetAndUpdate(ref ulong value, Func<ulong, ulong> updater)
Parameters
Type | Name | Description |
---|---|---|
ulong | value | Reference to a value to be modified. |
Func<ulong, ulong> | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
ulong | The original value. |
GetAndUpdate(ref nuint, Func<nuint, nuint>)
Atomically updates the stored value with the results of applying the given function, returning the original value.
Declaration
[CLSCompliant(false)]
public static nuint GetAndUpdate(ref nuint value, Func<nuint, nuint> updater)
Parameters
Type | Name | Description |
---|---|---|
nuint | value | Reference to a value to be modified. |
Func<nuint, nuint> | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
nuint | The original value. |
GetAndUpdate<TUpdater>(ref double, TUpdater)
Atomically updates the stored value with the results of applying the given function, returning the original value.
Declaration
public static double GetAndUpdate<TUpdater>(ref double value, TUpdater updater) where TUpdater : notnull, ISupplier<double, double>
Parameters
Type | Name | Description |
---|---|---|
double | value | Reference to a value to be modified. |
TUpdater | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
double | The original value. |
Type Parameters
Name | Description |
---|---|
TUpdater | The type implementing updater. |
GetAndUpdate<TUpdater>(ref int, TUpdater)
Atomically updates the stored value with the results of applying the given function, returning the original value.
Declaration
public static int GetAndUpdate<TUpdater>(ref int value, TUpdater updater) where TUpdater : notnull, ISupplier<int, int>
Parameters
Type | Name | Description |
---|---|---|
int | value | Reference to a value to be modified. |
TUpdater | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
int | The original value. |
Type Parameters
Name | Description |
---|---|
TUpdater | The type implementing updater. |
GetAndUpdate<TUpdater>(ref long, TUpdater)
Atomically updates the stored value with the results of applying the given function, returning the original value.
Declaration
public static long GetAndUpdate<TUpdater>(ref long value, TUpdater updater) where TUpdater : notnull, ISupplier<long, long>
Parameters
Type | Name | Description |
---|---|---|
long | value | Reference to a value to be modified. |
TUpdater | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
long | The original value. |
Type Parameters
Name | Description |
---|---|
TUpdater | The type implementing updater. |
GetAndUpdate<TUpdater>(ref nint, TUpdater)
Atomically updates the stored value with the results of applying the given function, returning the original value.
Declaration
public static nint GetAndUpdate<TUpdater>(ref nint value, TUpdater updater) where TUpdater : notnull, ISupplier<nint, nint>
Parameters
Type | Name | Description |
---|---|---|
nint | value | Reference to a value to be modified. |
TUpdater | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
nint | The original value. |
Type Parameters
Name | Description |
---|---|
TUpdater | The type implementing updater. |
GetAndUpdate<TUpdater>(ref float, TUpdater)
Atomically updates the stored value with the results of applying the given function, returning the original value.
Declaration
public static float GetAndUpdate<TUpdater>(ref float value, TUpdater updater) where TUpdater : notnull, ISupplier<float, float>
Parameters
Type | Name | Description |
---|---|---|
float | value | Reference to a value to be modified. |
TUpdater | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
float | The original value. |
Type Parameters
Name | Description |
---|---|
TUpdater | The type implementing updater. |
GetAndUpdate<TUpdater>(ref uint, TUpdater)
Atomically updates the stored value with the results of applying the given function, returning the original value.
Declaration
[CLSCompliant(false)]
public static uint GetAndUpdate<TUpdater>(ref uint value, TUpdater updater) where TUpdater : notnull, ISupplier<uint, uint>
Parameters
Type | Name | Description |
---|---|---|
uint | value | Reference to a value to be modified. |
TUpdater | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
uint | The original value. |
Type Parameters
Name | Description |
---|---|
TUpdater | The type implementing updater. |
GetAndUpdate<TUpdater>(ref ulong, TUpdater)
Atomically updates the stored value with the results of applying the given function, returning the original value.
Declaration
[CLSCompliant(false)]
public static ulong GetAndUpdate<TUpdater>(ref ulong value, TUpdater updater) where TUpdater : notnull, ISupplier<ulong, ulong>
Parameters
Type | Name | Description |
---|---|---|
ulong | value | Reference to a value to be modified. |
TUpdater | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
ulong | The original value. |
Type Parameters
Name | Description |
---|---|
TUpdater | The type implementing updater. |
GetAndUpdate<TUpdater>(ref nuint, TUpdater)
Atomically updates the stored value with the results of applying the given function, returning the original value.
Declaration
[CLSCompliant(false)]
public static nuint GetAndUpdate<TUpdater>(ref nuint value, TUpdater updater) where TUpdater : notnull, ISupplier<nuint, nuint>
Parameters
Type | Name | Description |
---|---|---|
nuint | value | Reference to a value to be modified. |
TUpdater | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
nuint | The original value. |
Type Parameters
Name | Description |
---|---|
TUpdater | The type implementing updater. |
IsAtomic<T>()
Determines that write to the location in the memory of
type T
is atomic.
Declaration
public static bool IsAtomic<T>()
Returns
Type | Description |
---|---|
bool |
Type Parameters
Name | Description |
---|---|
T | The type of the value to be written. |
UpdateAndGet(ref double, Func<double, double>)
Atomically updates the stored value with the results of applying the given function, returning the updated value.
Declaration
public static double UpdateAndGet(ref double value, Func<double, double> updater)
Parameters
Type | Name | Description |
---|---|---|
double | value | Reference to a value to be modified. |
Func<double, double> | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
double | The updated value. |
UpdateAndGet(ref int, Func<int, int>)
Atomically updates the stored value with the results of applying the given function, returning the updated value.
Declaration
public static int UpdateAndGet(ref int value, Func<int, int> updater)
Parameters
Type | Name | Description |
---|---|---|
int | value | Reference to a value to be modified. |
Func<int, int> | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
int | The updated value. |
UpdateAndGet(ref long, Func<long, long>)
Atomically updates the stored value with the results of applying the given function, returning the updated value.
Declaration
public static long UpdateAndGet(ref long value, Func<long, long> updater)
Parameters
Type | Name | Description |
---|---|---|
long | value | Reference to a value to be modified. |
Func<long, long> | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
long | The updated value. |
UpdateAndGet(ref nint, Func<nint, nint>)
Atomically updates the stored value with the results of applying the given function, returning the updated value.
Declaration
public static nint UpdateAndGet(ref nint value, Func<nint, nint> updater)
Parameters
Type | Name | Description |
---|---|---|
nint | value | Reference to a value to be modified. |
Func<nint, nint> | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
nint | The updated value. |
UpdateAndGet(ref float, Func<float, float>)
Atomically updates the stored value with the results of applying the given function, returning the updated value.
Declaration
public static float UpdateAndGet(ref float value, Func<float, float> updater)
Parameters
Type | Name | Description |
---|---|---|
float | value | Reference to a value to be modified. |
Func<float, float> | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
float | The updated value. |
UpdateAndGet(ref uint, Func<uint, uint>)
Atomically updates the stored value with the results of applying the given function, returning the updated value.
Declaration
[CLSCompliant(false)]
public static uint UpdateAndGet(ref uint value, Func<uint, uint> updater)
Parameters
Type | Name | Description |
---|---|---|
uint | value | Reference to a value to be modified. |
Func<uint, uint> | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
uint | The updated value. |
UpdateAndGet(ref ulong, Func<ulong, ulong>)
Atomically updates the stored value with the results of applying the given function, returning the updated value.
Declaration
[CLSCompliant(false)]
public static ulong UpdateAndGet(ref ulong value, Func<ulong, ulong> updater)
Parameters
Type | Name | Description |
---|---|---|
ulong | value | Reference to a value to be modified. |
Func<ulong, ulong> | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
ulong | The updated value. |
UpdateAndGet(ref nuint, Func<nuint, nuint>)
Atomically updates the stored value with the results of applying the given function, returning the updated value.
Declaration
[CLSCompliant(false)]
public static nuint UpdateAndGet(ref nuint value, Func<nuint, nuint> updater)
Parameters
Type | Name | Description |
---|---|---|
nuint | value | Reference to a value to be modified. |
Func<nuint, nuint> | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
nuint | The updated value. |
UpdateAndGet<TUpdater>(ref double, TUpdater)
Atomically updates the stored value with the results of applying the given function, returning the updated value.
Declaration
public static double UpdateAndGet<TUpdater>(ref double value, TUpdater updater) where TUpdater : notnull, ISupplier<double, double>
Parameters
Type | Name | Description |
---|---|---|
double | value | Reference to a value to be modified. |
TUpdater | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
double | The updated value. |
Type Parameters
Name | Description |
---|---|
TUpdater | The type implementing updater. |
UpdateAndGet<TUpdater>(ref int, TUpdater)
Atomically updates the stored value with the results of applying the given function, returning the updated value.
Declaration
public static int UpdateAndGet<TUpdater>(ref int value, TUpdater updater) where TUpdater : notnull, ISupplier<int, int>
Parameters
Type | Name | Description |
---|---|---|
int | value | Reference to a value to be modified. |
TUpdater | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
int | The updated value. |
Type Parameters
Name | Description |
---|---|
TUpdater | The type implementing updater. |
UpdateAndGet<TUpdater>(ref long, TUpdater)
Atomically updates the stored value with the results of applying the given function, returning the updated value.
Declaration
public static long UpdateAndGet<TUpdater>(ref long value, TUpdater updater) where TUpdater : notnull, ISupplier<long, long>
Parameters
Type | Name | Description |
---|---|---|
long | value | Reference to a value to be modified. |
TUpdater | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
long | The updated value. |
Type Parameters
Name | Description |
---|---|
TUpdater | The type implementing updater. |
UpdateAndGet<TUpdater>(ref nint, TUpdater)
Atomically updates the stored value with the results of applying the given function, returning the updated value.
Declaration
public static nint UpdateAndGet<TUpdater>(ref nint value, TUpdater updater) where TUpdater : notnull, ISupplier<nint, nint>
Parameters
Type | Name | Description |
---|---|---|
nint | value | Reference to a value to be modified. |
TUpdater | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
nint | The updated value. |
Type Parameters
Name | Description |
---|---|
TUpdater | The type implementing updater. |
UpdateAndGet<TUpdater>(ref float, TUpdater)
Atomically updates the stored value with the results of applying the given function, returning the updated value.
Declaration
public static float UpdateAndGet<TUpdater>(ref float value, TUpdater updater) where TUpdater : notnull, ISupplier<float, float>
Parameters
Type | Name | Description |
---|---|---|
float | value | Reference to a value to be modified. |
TUpdater | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
float | The updated value. |
Type Parameters
Name | Description |
---|---|
TUpdater | The type implementing updater. |
UpdateAndGet<TUpdater>(ref uint, TUpdater)
Atomically updates the stored value with the results of applying the given function, returning the updated value.
Declaration
[CLSCompliant(false)]
public static uint UpdateAndGet<TUpdater>(ref uint value, TUpdater updater) where TUpdater : notnull, ISupplier<uint, uint>
Parameters
Type | Name | Description |
---|---|---|
uint | value | Reference to a value to be modified. |
TUpdater | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
uint | The updated value. |
Type Parameters
Name | Description |
---|---|
TUpdater | The type implementing updater. |
UpdateAndGet<TUpdater>(ref ulong, TUpdater)
Atomically updates the stored value with the results of applying the given function, returning the updated value.
Declaration
[CLSCompliant(false)]
public static ulong UpdateAndGet<TUpdater>(ref ulong value, TUpdater updater) where TUpdater : notnull, ISupplier<ulong, ulong>
Parameters
Type | Name | Description |
---|---|---|
ulong | value | Reference to a value to be modified. |
TUpdater | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
ulong | The updated value. |
Type Parameters
Name | Description |
---|---|
TUpdater | The type implementing updater. |
UpdateAndGet<TUpdater>(ref nuint, TUpdater)
Atomically updates the stored value with the results of applying the given function, returning the updated value.
Declaration
[CLSCompliant(false)]
public static nuint UpdateAndGet<TUpdater>(ref nuint value, TUpdater updater) where TUpdater : notnull, ISupplier<nuint, nuint>
Parameters
Type | Name | Description |
---|---|---|
nuint | value | Reference to a value to be modified. |
TUpdater | updater | A side-effect-free function. |
Returns
Type | Description |
---|---|
nuint | The updated value. |
Type Parameters
Name | Description |
---|---|
TUpdater | The type implementing updater. |