refactoring hm.popAll to hm.drain
Vladimir Bauer
3 years ago
| 11 | 11 | h_sync heapCmd = iota |
| 12 | 12 | h_push |
| 13 | 13 | h_iter |
| 14 | h_pop_all | |
| 14 | h_drain | |
| 15 | 15 | h_fix |
| 16 | 16 | h_end |
| 17 | 17 | ) |
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | close(data.iter) |
| 77 | case h_pop_all: | |
| 77 | case h_drain: | |
| 78 | 78 | data := req.data.(*iterData) |
| 79 | 79 | for bHeap.Len() != 0 { |
| 80 | 80 | select { |
| 111 | 111 | m <- heapRequest{cmd: h_iter, data: data} |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | func (m heapManager) popAll(iter chan *Bar, drop chan struct{}) { | |
| 114 | func (m heapManager) drain(iter chan *Bar, drop chan struct{}) { | |
| 115 | 115 | data := &iterData{iter, drop} |
| 116 | m <- heapRequest{cmd: h_pop_all, data: data} | |
| 116 | m <- heapRequest{cmd: h_drain, data: data} | |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | func (m heapManager) fix(index int) { |