Ejemplo n.º 1
0
 /// <summary>
 /// Get the event for a given sequence in the RingBuffer.
 ///
 /// This call has 2 uses.  Firstly use this call when publishing to a ring buffer.
 /// After calling <see cref="Next()"/> use this call to get hold of the
 /// preallocated event to fill with data before calling <see cref="Publish(long)"/>.
 ///
 /// Secondly use this call when consuming data from the ring buffer.  After calling
 /// <see cref="ISequenceBarrier.WaitFor"/> call this method with any value greater than
 /// that your current consumer sequence and less than or equal to the value returned from
 /// the <see cref="ISequenceBarrier.WaitFor"/> method.
 /// </summary>
 /// <param name="sequence">sequence for the event</param>
 /// <returns>the event for the given sequence</returns>
 public T this[long sequence]
 {
     [MethodImpl(MethodImplOptions.AggressiveInlining)]
     get
     {
         return(Util.Read <T>(_fields.Entries, RingBufferFields.BufferPad + (int)(sequence & _fields.IndexMask)));
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Get the event for a given sequence in the RingBuffer.
 ///
 /// This call has 2 uses.  Firstly use this call when publishing to a ring buffer.
 /// After calling <see cref="RingBuffer.Next()"/> use this call to get hold of the
 /// preallocated event to fill with data before calling <see cref="RingBuffer.Publish(long)"/>.
 ///
 /// Secondly use this call when consuming data from the ring buffer.  After calling
 /// <see cref="ISequenceBarrier.WaitFor"/> call this method with any value greater than
 /// that your current consumer sequence and less than or equal to the value returned from
 /// the <see cref="ISequenceBarrier.WaitFor"/> method.
 /// </summary>
 /// <param name="sequence">sequence for the event</param>
 /// <returns>the event for the given sequence</returns>
 public T this[long sequence]
 {
     [MethodImpl(MethodImplOptions.AggressiveInlining)]
     get
     {
         return(Util.Read <T>(_entries, _bufferPadRef + (int)(sequence & _indexMask)));
     }
 }