public void Should_return_correct_values_for_multiclaim2() { var blockingWaitStrategy = new BlockingWaitStrategy(); var writer = new ConcurrentRingBufferWriter(5, blockingWaitStrategy); var first = writer.Claim(3); var second = writer.Claim(4); Assert.That(first, Is.EqualTo(2)); Assert.That(second, Is.EqualTo(6)); writer.Commit(second, 4); writer.Commit(first, 3); }
private void Write(string name, int value) { long sequence = _committer.Claim(); _buffer[sequence] = value; Console.WriteLine("+{0}: {1}", name, value); _committer.Commit(sequence, 1); }