DiscardAndClose closes the queue and removes all the items from it.
()
| 74 | |
| 75 | // DiscardAndClose closes the queue and removes all the items from it. |
| 76 | func (pq *PriorityQueue) DiscardAndClose() { |
| 77 | pq.lock.Lock() |
| 78 | defer pq.lock.Unlock() |
| 79 | pq.closed = true |
| 80 | pq.queue = nil |
| 81 | pq.cond.Broadcast() |
| 82 | } |
| 83 | |
| 84 | // Enqueue adds an operation to the queue in priority order. |
| 85 | func (pq *PriorityQueue) Enqueue(op PriorityOp) { |