DotNext by Roman Sakno

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

 AtomicEnum<E>

public struct AtomicEnum<E> : IEquatable<E>, ISerializable where E : struct, Enum
Represents atomic enum value.
public E Value { get; set; }

Gets or sets enum value in volatile manner.

public AtomicEnum(E value)

Initializes a new atomic boolean container with initial value.

public E AccumulateAndGet(E x, Func<E, E, E> 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 E AccumulateAndGet(E x, ref ValueFunc 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 bool CompareAndSet(E expected, E update)

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

public E CompareExchange(E update, E expected)

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

public bool Equals(E other)

Determines whether stored value is equal to value passed as argument.

public E GetAndAccumulate(E x, Func<E, E, E> 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 E GetAndAccumulate(E x, ref ValueFunc 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 E GetAndSet(E update)

Modifies the current value atomically.

public E GetAndUpdate(Func<E, E> updater)

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

public E GetAndUpdate(ref ValueFunc updater)

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

public E SetAndGet(E update)

Modifies the current value atomically.

public E UpdateAndGet(Func<E, E> updater)

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

public E UpdateAndGet(ref ValueFunc updater)

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