Codebase list golang-github-vbauerster-mpb / 0d8850b
Add remove bool param to *Progress.Abort method Vladimir Bauer 7 years ago
1 changed file(s) with 4 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
117117 // it means remove bar now without waiting for its completion.
118118 // If bar is already completed, there is nothing to abort.
119119 // If you need to remove bar after completion, use BarRemoveOnComplete BarOption.
120 func (p *Progress) Abort(b *Bar) {
120 func (p *Progress) Abort(b *Bar, remove bool) {
121121 select {
122122 case p.operateState <- func(s *pState) {
123123 if b.index < 0 {
124124 return
125125 }
126 s.heapUpdated = heap.Remove(s.bHeap, b.index) != nil
126 if remove {
127 s.heapUpdated = heap.Remove(s.bHeap, b.index) != nil
128 }
127129 s.shutdownPending = append(s.shutdownPending, b)
128130 }:
129131 case <-p.done: