DotNext by Roman Sakno

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

 AtomicBoolean

public struct AtomicBoolean : IEquatable<bool>, ISerializable
Represents atomic boolean.
public bool Value { get; set; }

Gets or sets boolean value in volatile manner.

public AtomicBoolean(bool value)

Initializes a new atomic boolean container with initial value.

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

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

public bool CompareExchange(bool update, bool expected)

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

public bool Equals(bool other)

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

public bool FalseToTrue()

Atomically sets true value if the current value is false.

public bool GetAndAccumulate(bool x, Func<bool, bool, bool> 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 bool GetAndAccumulate(bool 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 bool GetAndNegate()

Negates currently stored value atomically.

public bool GetAndSet(bool update)

Modifies the current value atomically.

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

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

public bool GetAndUpdate(ref ValueFunc updater)

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

public bool NegateAndGet()

Negates currently stored value atomically.

public bool SetAndGet(bool update)

Modifies the current value atomically.

public bool TrueToFalse()

Atomically sets false value if the current value is true.

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

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

public bool UpdateAndGet(ref ValueFunc updater)

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