예제 #1
0
        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);
        }
예제 #2
0
        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));
        }
예제 #3
0
        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);
        }
예제 #4
0
        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));
        }
예제 #5
0
        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);
        }
예제 #6
0
        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));
        }