Heap is a thread-safe producer/consumer queue that implements a heap data structure. It can be used to implement priority queues and similar data structures.
| 115 | // Heap is a thread-safe producer/consumer queue that implements a heap data structure. |
| 116 | // It can be used to implement priority queues and similar data structures. |
| 117 | type Heap struct { |
| 118 | lock sync.RWMutex |
| 119 | cond sync.Cond |
| 120 | |
| 121 | // data stores objects and has a queue that keeps their ordering according |
| 122 | // to the heap invariant. |
| 123 | data *heapData |
| 124 | |
| 125 | // closed indicates that the queue is closed. |
| 126 | // It is mainly used to let Pop() exit its control loop while waiting for an item. |
| 127 | closed bool |
| 128 | } |
| 129 | |
| 130 | // Close the Heap and signals condition variables that may be waiting to pop |
| 131 | // items from the heap. |
nothing calls this directly
no outgoing calls
no test coverage detected