Esempio n. 1
0
        public void Remove(ThreadQueueItem item)
        {
            VTable.Assert(item.Queue == this);

            if (item.Next != null)
            {
                item.Next.Prev = item.Prev;
            }
            else
            {
                VTable.Assert(item == tail);
                tail = item.Prev;
            }

            if (item.Prev != null)
            {
                item.Prev.Next = item.Next;
            }
            else
            {
                VTable.Assert(item == head);
                head = item.Next;
            }

            item.Next  = null;
            item.Prev  = null;
            item.Queue = null;
        }
Esempio n. 2
0
        public ThreadQueueItem Dequeue()
        {
            ThreadQueueItem item = head;

            if (item != null)
            {
                Remove(item);
            }

            return(item);
        }
Esempio n. 3
0
        public void Enqueue(ThreadQueueItem item)
        {
            VTable.Assert(item.Next == null);
            VTable.Assert(item.Prev == null);
            VTable.Assert(item.Queue == null);

            item.Queue = this;
            item.Prev  = tail;

            if (tail != null)
            {
                VTable.Assert(tail.Next == null);
                tail.Next = item;
            }
            else
            {
                VTable.Assert(head == null);
                head = item;
            }

            tail = item;
        }