Esempio n. 1
0
        public void ShouldIndicateHasAvailableCapacity()
        {
            _sequencer.AddGatingSequences(_gatingSequence);

            Assert.IsTrue(_sequencer.HasAvailableCapacity(1));
            Assert.IsTrue(_sequencer.HasAvailableCapacity(_bufferSize));
            Assert.False(_sequencer.HasAvailableCapacity(_bufferSize + 1));

            _sequencer.Publish(_sequencer.Next());

            Assert.IsTrue(_sequencer.HasAvailableCapacity(_bufferSize - 1));
            Assert.False(_sequencer.HasAvailableCapacity(_bufferSize));
        }
Esempio n. 2
0
 /// <summary>
 /// Given specified <param name="requiredCapacity"></param> determines if that amount of space is available.Note, you can not assume that if this method returns <c>true</c> that a call to <see cref="RingBuffer{TEvent}.Next()"/> will not block. Especially true if this ring buffer is set up to handle multiple producers.
 /// </summary>
 /// <param name="requiredCapacity"></param>
 /// <returns></returns>
 public bool HasAvailableCapacity(int requiredCapacity)
 {
     return(Sequencer.HasAvailableCapacity(requiredCapacity));
 }
Esempio n. 3
0
 public void ShouldIndicateAvailableCapacity()
 {
     Assert.IsTrue(_sequencer.HasAvailableCapacity(1));
 }