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