DotNext by .NET Foundation and Contributors

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

 IInterlockedOperations<T>

public interface IInterlockedOperations<T>
Represents interlocked operations.
using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace DotNext.Threading { [NullableContext(1)] public interface IInterlockedOperations<[Nullable(2)] T> { T VolatileRead([In] [RequiresLocation] T location); void VolatileWrite(ref T location, T value); T CompareExchange(ref T location, T value, T comparand); } }