Codebase list golang-github-vbauerster-mpb / f073e20
don't panic, on second p.Abort(*Bar) Vladimir Bauer 8 years ago
1 changed file(s) with 4 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
119119 func (p *Progress) Abort(b *Bar) {
120120 select {
121121 case p.operateState <- func(s *pState) {
122 if b.index < 0 {
123 return
124 }
122125 s.heapUpdated = heap.Remove(s.bHeap, b.index) != nil
123126 s.shutdownPending = append(s.shutdownPending, b)
124127 }:
221224 s.heapUpdated = true
222225 delete(s.waitBars, bf.bar)
223226 }
227 // defer is required to make removeOnComplete visually happen
224228 defer func() {
225229 s.shutdownPending = append(s.shutdownPending, bf.bar)
226230 }()