Show / Hide Table of Contents

Class Atomic

Exposes atomic operations for thread-safe scenarios.

Inheritance
object
Atomic
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DotNext.Threading
Assembly: DotNext.dll
Syntax
public static class Atomic

Methods

| Edit this page View Source

AccumulateAndGet(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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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

true if write is atomic; otherwise, false.

Type Parameters
Name Description
T

The type of the value to be written.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

| Edit this page View Source

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 : 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.

  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾