private void Grow(int newCapacity)
 {
     T[] oldItems = Items;
     T[] items    = new T[Math.Max(newCapacity, 31)];
     Array.Copy(oldItems, 0, items, 0, oldItems.Length);
     Concurrency.LockFreeUpdate(ref Items, items);
 }
        public void Clear()
        {
            Count = 0;
            T[] items = new T[31];
            Concurrency.LockFreeUpdate(ref Items, items);

            //for (int i = 0, count = Count; i < count; i++)
            //	Items [i] = null;
            //Count = 0;
        }
示例#3
0
        // *** Adding Items ***

        public void AddFirst(T value)
        {
            Node node = new Node(value);

            node.Next = Head;
            Concurrency.LockFreeUpdate(ref m_Head, node);
            if (Current == null)
            {
                Current = node;
            }
            Count++;
            OnInsert(value);
        }