コード例 #1
0
        /// <summary>
        /// Constructs an instance with the given capacity rounded up to
        /// the next power-of-2 value.
        /// </summary>
        /// <param name="capacity">The target capacity.</param>
        public SpscLinkedArrayQueue(int capacity)
        {
            int c = QueueHelper.Round(capacity < 2 ? 2 : capacity);

            mask          = c - 1;
            consumerArray = producerArray = new Entry[c];
            Volatile.Write(ref consumerIndex, 0L); // FIXME not sure if C# constructor with readonly field does release or not
        }
コード例 #2
0
 /// <inheritdoc/>
 public void Clear()
 {
     QueueHelper.Clear(this);
 }