Пример #1
0
        public void AtomicInteger_Load_Should_Fail()
        {
            var atomicInteger = new AtomicInteger(int.MaxValue);

            Assert.Throws <InvalidOperationException>(() => atomicInteger.Load(MemoryOrder.Release));
            Assert.Throws <NotSupportedException>(() => atomicInteger.Load(MemoryOrder.Consume));
        }
 public void AtomicInteger_Load_Should_Success()
 {
     var atomicInteger = new AtomicInteger(int.MaxValue);
     Assert.Equal(int.MaxValue, atomicInteger.Load(MemoryOrder.Relaxed));
     Assert.Equal(int.MaxValue, atomicInteger.Load(MemoryOrder.Acquire));
     Assert.Equal(int.MaxValue, atomicInteger.Load(MemoryOrder.AcqRel));
     Assert.Equal(int.MaxValue, atomicInteger.Load(MemoryOrder.SeqCst));
 }
Пример #3
0
        public void AtomicInteger_Load_Should_Success()
        {
            var atomicInteger = new AtomicInteger(int.MaxValue);

            Assert.Equal(int.MaxValue, atomicInteger.Load(MemoryOrder.Relaxed));
            Assert.Equal(int.MaxValue, atomicInteger.Load(MemoryOrder.Acquire));
            Assert.Equal(int.MaxValue, atomicInteger.Load(MemoryOrder.AcqRel));
            Assert.Equal(int.MaxValue, atomicInteger.Load(MemoryOrder.SeqCst));
        }
 public void AtomicInteger_Load_Should_Fail()
 {
     var atomicInteger = new AtomicInteger(int.MaxValue);
     Assert.Throws<InvalidOperationException>(() => atomicInteger.Load(MemoryOrder.Release));
     Assert.Throws<NotSupportedException>(() => atomicInteger.Load(MemoryOrder.Consume));
 }