RaspberryIO/Unosquare.Swan.Lite/AtomicLong.cs
2019-12-04 17:10:06 +01:00

25 lines
767 B
C#

using System;
using Unosquare.Swan.Abstractions;
namespace Unosquare.Swan {
/// <summary>
/// Fast, atomioc long combining interlocked to write value and volatile to read values.
/// </summary>
public sealed class AtomicLong : AtomicTypeBase<Int64> {
/// <summary>
/// Initializes a new instance of the <see cref="AtomicLong"/> class.
/// </summary>
/// <param name="initialValue">if set to <c>true</c> [initial value].</param>
public AtomicLong(Int64 initialValue = default)
: base(initialValue) {
// placeholder
}
/// <inheritdoc />
protected override Int64 FromLong(Int64 backingValue) => backingValue;
/// <inheritdoc />
protected override Int64 ToLong(Int64 value) => value;
}
}