示例#1
0
        public void Spinlock_Works()
        {
            var spinner = new Spinlock(3);

            spinner.DoInsertions(2017);

            Assert.Equal(638, spinner.Buffer[spinner.CurrentPosition + 1]);
        }
示例#2
0
        public void Spinlock_Zero_StaysAtStart(int spin)
        {
            var spinner = new Spinlock(spin);

            for (int i = 0; i < 50000; i++)
            {
                spinner.DoInsertions(1);
                Assert.Equal(0, spinner.Buffer[0]);
            }
        }