Codebase list golang-github-vbauerster-mpb / a32e0ee
refactoring hm.popAll to hm.drain Vladimir Bauer 3 years ago
2 changed file(s) with 5 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
1111 h_sync heapCmd = iota
1212 h_push
1313 h_iter
14 h_pop_all
14 h_drain
1515 h_fix
1616 h_end
1717 )
7474 }
7575 }
7676 close(data.iter)
77 case h_pop_all:
77 case h_drain:
7878 data := req.data.(*iterData)
7979 for bHeap.Len() != 0 {
8080 select {
111111 m <- heapRequest{cmd: h_iter, data: data}
112112 }
113113
114 func (m heapManager) popAll(iter chan *Bar, drop chan struct{}) {
114 func (m heapManager) drain(iter chan *Bar, drop chan struct{}) {
115115 data := &iterData{iter, drop}
116 m <- heapRequest{cmd: h_pop_all, data: data}
116 m <- heapRequest{cmd: h_drain, data: data}
117117 }
118118
119119 func (m heapManager) fix(index int) {
307307
308308 iter := make(chan *Bar)
309309 drop := make(chan struct{})
310 s.hm.popAll(iter, drop)
310 s.hm.drain(iter, drop)
311311
312312 for b := range iter {
313313 frame := <-b.frameCh