DotNext by .NET Foundation and Contributors

<PackageReference Include="DotNext" Version="4.12.0" />

 AtomicUInt64

public static class AtomicUInt64
Various atomic operations for UInt64 data type accessible as extension methods.
public static ulong AccumulateAndGet(this ref ulong value, ulong x, Func<ulong, ulong, ulong> accumulator)

Atomically updates the current value with the results of applying the given function to the current and given values, returning the updated value.

public static ulong AccumulateAndGet(this ref ulong value, ulong x, method accumulator)

public static ulong AddAndGet(this ref ulong value, ulong operand)

Adds two 64-bit integers and replaces referenced integer with the sum, as an atomic operation.

public static ulong BitwiseAndAndGet(this ref ulong value, ulong operand)

Bitwise "ands" two 64-bit integers and replaces referenced integer with the result, as an atomic operation.

public static ulong BitwiseOrAndGet(this ref ulong value, ulong operand)

Bitwise "ors" two 64-bit integers and replaces referenced integer with the result, as an atomic operation.

public static ulong BitwiseXorAndGet(this ref ulong value, ulong operand)

Bitwise "xors" two 64-bit integers and replaces referenced integer with the result, as an atomic operation.

public static bool CompareAndSet(this ref ulong value, ulong expected, ulong update)

Atomically sets referenced value to the given updated value if the current value == the expected value.

public static ulong DecrementAndGet(this ref ulong value)

Atomically decrements by one the current value.

public static ulong GetAndAccumulate(this ref ulong value, ulong x, Func<ulong, ulong, ulong> accumulator)

Atomically updates the current value with the results of applying the given function to the current and given values, returning the original value.

public static ulong GetAndAccumulate(this ref ulong value, ulong x, method accumulator)

public static ulong GetAndAdd(this ref ulong value, ulong operand)

Adds two 64-bit integers and replaces referenced integer with the sum, as an atomic operation.

public static ulong GetAndBitwiseAnd(this ref ulong value, ulong operand)

Bitwise "ands" two 64-bit integers and replaces referenced integer with the result, as an atomic operation.

public static ulong GetAndBitwiseOr(this ref ulong value, ulong operand)

Bitwise "ors" two 64-bit integers and replaces referenced integer with the result, as an atomic operation.

public static ulong GetAndBitwiseXor(this ref ulong value, ulong operand)

Bitwise "xors" two 64-bit integers and replaces referenced integer with the result, as an atomic operation.

public static ulong GetAndSet(this ref ulong value, ulong update)

Modifies referenced value atomically.

public static ulong GetAndUpdate(this ref ulong value, Func<ulong, ulong> updater)

Atomically updates the stored value with the results of applying the given function, returning the original value.

public static ulong GetAndUpdate(this ref ulong value, method updater)

public static ulong IncrementAndGet(this ref ulong value)

Atomically increments by one referenced value.

public static ulong SetAndGet(this ref ulong value, ulong update)

Modifies value atomically.

public static ulong UpdateAndGet(this ref ulong value, Func<ulong, ulong> updater)

Atomically updates the stored value with the results of applying the given function, returning the updated value.

public static ulong UpdateAndGet(this ref ulong value, method updater)

public static ulong VolatileRead(this ref ulong value)

Reads the value of the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears after this method in the code, the processor cannot move it before this method.

public static void VolatileWrite(this ref ulong value, ulong newValue)

Writes the specified value to the specified field. On systems that require it, inserts a memory barrier that prevents the processor from reordering memory operations as follows: If a read or write appears before this method in the code, the processor cannot move it after this method.