DotNext by .NET Foundation and Contributors

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

 AtomicUInt32

public static class AtomicUInt32
Various atomic operations for UInt32 data type accessible as extension methods.
public static uint AccumulateAndGet(this ref uint value, uint x, Func<uint, uint, uint> 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 uint AccumulateAndGet(this ref uint value, uint x, method accumulator)

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

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

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

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

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

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

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

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

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

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

public static uint DecrementAndGet(this ref uint value)

Atomically decrements the referenced value by one.

public static uint GetAndAccumulate(this ref uint value, uint x, Func<uint, uint, uint> 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 uint GetAndAccumulate(this ref uint value, uint x, method accumulator)

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

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

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

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

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

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

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

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

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

Modifies the referenced value atomically.

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

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

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

public static uint IncrementAndGet(this ref uint value)

Atomically increments the referenced value by one.

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

Modifies the referenced value atomically.

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

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

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

public static uint VolatileRead(this ref uint 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 uint value, uint 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.