/// <summary>Initialize the priority queue.</summary>
 /// <param name="queue">The queue to be synchronized.</param>
 internal ChoSyncPriorityQueue(ChoPriorityQueue queue)
 {
     // NOTE: We're synchronizing just be using a synchronized heap!
     // This implementation will need to change if we get more state.
     if (!(_heap is ChoBinaryHeap.ChoSyncBinaryHeap))
     {
         _heap = ChoBinaryHeap.Synchronize(_heap);
     }
 }
        public static ChoPriorityQueue BlockingQueue(ChoPriorityQueue queue)
        {
            // Return the queue if it is already synchronized.  Otherwise, wrap it
            // with a synchronized wrapper.
            if (queue is ChoBlockingPriorityQueue)
            {
                return(queue);
            }

            return(new ChoBlockingPriorityQueue(queue));
        }
 /// <summary>Initialize the queue.</summary>
 /// <param name="queue">The queue is intialized with a shalled-copy of this queue.</param>
 public ChoPriorityQueue(ChoPriorityQueue queue)
 {
     _heap = queue._heap.Clone();
 }
 internal ChoBlockingPriorityQueue(ChoPriorityQueue q)
 {
     _queue = q;
 }