Beispiel #1
0
        public void InterlockedOr_Int64()
        {
            long value = 0x12345670;

            Assert.Equal(0x12345670, Interlocked.Or(ref value, 0x7654321));
            Assert.Equal(0x17755771, value);
        }
Beispiel #2
0
        public void InterlockedOr_UInt64()
        {
            ulong value = 0x12345670u;

            Assert.Equal(0x12345670u, Interlocked.Or(ref value, 0x7654321));
            Assert.Equal(0x17755771u, value);
        }
Beispiel #3
0
        public void SetHandleAsInvalid()
        {
            Debug.Assert(_fullyInitialized);

            // Set closed state (low order bit of the _state field).
            Interlocked.Or(ref _state, StateBits.Closed);

            GC.SuppressFinalize(this);
        }
Beispiel #4
0
 private static nuint mi_atomic_fetch_or_explicit([NativeTypeName("std::atomic<uintptr_t>*")] ref nuint p, [NativeTypeName("uintptr_t")] nuint x, mi_memory_order_t mo)
 {
     if (Environment.Is64BitProcess)
     {
         return((nuint)Interlocked.Or(ref Unsafe.As <nuint, ulong>(ref p), x));
     }
     else
     {
         return(Interlocked.Or(ref Unsafe.As <nuint, uint>(ref p), (uint)x));
     }
 }