DotNext by .NET Foundation and Contributors

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

 AtomicSingle

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

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

Adds two 64-bit floating-point numbers and replaces referenced storage with the sum, as an atomic operation.

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

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

public static float DecrementAndGet(this ref float value)

Atomically decrements by one the current value.

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

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

Adds two 64-bit floating-point numbers and replaces referenced storage with the sum, as an atomic operation.

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

Modifies referenced value atomically.

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

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

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

public static float IncrementAndGet(this ref float value)

Atomically increments by one referenced value.

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

Modifies value atomically.

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

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

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

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