Example #1
0
        public void InterlockedMaxDouble()
        {
            double x = 0;

            Assert.AreEqual(0, InterlockedExtensions.TryOptomisticMax(ref x, -1));

            x = 0;
            Assert.AreEqual(1, InterlockedExtensions.TryOptomisticMax(ref x, 1));
        }
Example #2
0
        public void InterlockedMaxLong()
        {
            long x = 0;

            Assert.AreEqual(0, InterlockedExtensions.TryOptomisticMax(ref x, -1));

            x = 0;
            Assert.AreEqual(1, InterlockedExtensions.TryOptomisticMax(ref x, 1));
        }