NewHeap returns a Heap which can be used to queue up items to process.
(keyFn KeyFunc, lessFn LessFunc)
| 310 | |
| 311 | // NewHeap returns a Heap which can be used to queue up items to process. |
| 312 | func NewHeap(keyFn KeyFunc, lessFn LessFunc) *Heap { |
| 313 | h := &Heap{ |
| 314 | data: &heapData{ |
| 315 | items: map[string]*heapItem{}, |
| 316 | queue: []string{}, |
| 317 | keyFunc: keyFn, |
| 318 | lessFunc: lessFn, |
| 319 | }, |
| 320 | } |
| 321 | h.cond.L = &h.lock |
| 322 | return h |
| 323 | } |
no outgoing calls