public void AtomicInt64SupportsPreDecrementMultiThreaded() { const long expected = 0; var i = new AtomicInt64(); i.Value = 1000; System.Threading.Tasks.Parallel.For(0, 1000, j => i.PreDecrement()); Assert.AreEqual(expected, (long)i); Assert.AreEqual(expected, i.Value); }
public void AtomicInt64SupportsPreDecrement() { const long expected = 0; var i = new AtomicInt64(); i.Value = 1000; for (int j = 0; j < 1000; j++) { i.PreDecrement(); } Assert.AreEqual(expected, (long)i); Assert.AreEqual(expected, i.Value); }