public static void Write(ref CLRAtomicInt data, int newValue, [CallerMemberName] string memberName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) { var atomic = CLRAtomicInt.Get(ref data); // All writes are release in the CLR, but see the comment above. atomic.Store(newValue, MemoryOrder.Relaxed, memberName, sourceFilePath, sourceLineNumber); }
public static int Read(ref CLRAtomicInt data, [CallerMemberName] string memberName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) { var atomic = CLRAtomicInt.Get(ref data); return(atomic.Load(MemoryOrder.Relaxed, memberName, sourceFilePath, sourceLineNumber)); }
public static void Write(ref CLRAtomicInt data, int newValue, [CallerMemberName] string memberName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) { var atomic = CLRAtomicInt.Get(ref data); atomic.Store(newValue, MemoryOrder.Release, memberName, sourceFilePath, sourceLineNumber); }
public static bool CompareExchange(ref CLRAtomicInt data, int newData, int comparand, [CallerMemberName] string memberName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) { var atomic = CLRAtomicInt.Get(ref data); return(atomic.CompareExchange(newData, comparand, MemoryOrder.SequentiallyConsistent, memberName, sourceFilePath, sourceLineNumber)); }
public static void Exchange(ref CLRAtomicInt data, int newData, [CallerMemberName] string memberName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) { var atomic = CLRAtomicInt.Get(ref data); atomic.Exchange(newData, MemoryOrder.SequentiallyConsistent, memberName, sourceFilePath, sourceLineNumber); }
public static int Decrement(ref CLRAtomicInt data, [CallerMemberName] string memberName = "", [CallerFilePath] string sourceFilePath = "", [CallerLineNumber] int sourceLineNumber = 0) { var atomic = CLRAtomicInt.Get(ref data); return(atomic.Decrement(MemoryOrder.SequentiallyConsistent, memberName, sourceFilePath, sourceLineNumber)); }