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