using System;
namespace Swan.Threading {
///
/// Fast, atomic boolean combining interlocked to write value and volatile to read values.
///
public sealed class AtomicBoolean : AtomicTypeBase {
///
/// Initializes a new instance of the class.
///
/// if set to true [initial value].
public AtomicBoolean(Boolean initialValue = default) : base(initialValue ? 1 : 0) {
// placeholder
}
///
protected override Boolean FromLong(Int64 backingValue) => backingValue != 0;
///
protected override Int64 ToLong(Boolean value) => value ? 1 : 0;
}
}