/// <summary> /// Gets all queued objects from the queue, blocking until at least one is available, /// or throws ThreadSafeQueueTerminatedException if the queue is terminated. /// </summary> /// <returns>All of the objects in the queue</returns> /// <exception cref="ThreadSafeQueueTerminatedException"> /// The queue has been terminated. Note that this can occur /// even if the queue was not terminated at the time the /// method was called. /// </exception> public virtual LinkedList DequeueAll() { lock (this) { while (!ItemsAvailable() && !terminated) { Monitor.Wait(this); } if (!ItemsAvailable()) { Debug.Assert(terminated); throw new ThreadSafeQueueTerminatedException(); } LinkedList returnList = list; list = new LinkedList(); return returnList; } }
public LLEnum(LinkedList list) { seqnum = list.sequenceNum; this.list = list; this.currNode = list.head; }