Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
 /// <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));
 }