public void TestAtomicInt64OperatorIncrement() { for (var j = 0; j < 10; j++) { var atomic = AtomicInt64.From(0); var tasks = new Task[100]; for (var i = 0; i < 100; i++) { tasks[i] = Task.Factory.StartNew(() => atomic.Increment()); } Task.WaitAll(tasks); Assert.Equal(100, atomic.Value); } }
public void TestAtomicInt64OperatorMinus() { for (var j = 0; j < 10; j++) { var x = AtomicInt64.From(1000); var tasks = new Task[100]; for (var i = 0; i < 100; i++) { tasks[i] = Task.Factory.StartNew(() => x.Minus(5)); } Task.WaitAll(tasks); Assert.Equal(500, x.Value); } }
public AtomicSequence() { seq = AtomicInt64.From(0); }
public POCopStats() { intervalCount = AtomicInt64.From(0); totalOpsDone = AtomicInt64.From(0); slowOps = AtomicInt64.From(0); }