public void ShouldAddLongOrderedToNativeBuffer(IAtomicBuffer buffer) { var initialValue = int.MaxValue + 7L; const long increment = 9L; buffer.PutLongOrdered(Index, initialValue); buffer.AddLongOrdered(Index, increment); Assert.That(Marshal.ReadInt64(buffer.BufferPointer, Index), Is.EqualTo(initialValue + increment)); }
/// <summary> /// Perform an atomic increment that is not safe across threads. /// </summary> /// <returns> the previous value of the counter </returns> public long OrderedIncrement() { return(_buffer.AddLongOrdered(_offset, 1)); }