don't panic, on second p.Abort(*Bar)
Vladimir Bauer
8 years ago
| 119 | 119 | func (p *Progress) Abort(b *Bar) { |
| 120 | 120 | select { |
| 121 | 121 | case p.operateState <- func(s *pState) { |
| 122 | if b.index < 0 { | |
| 123 | return | |
| 124 | } | |
| 122 | 125 | s.heapUpdated = heap.Remove(s.bHeap, b.index) != nil |
| 123 | 126 | s.shutdownPending = append(s.shutdownPending, b) |
| 124 | 127 | }: |
| 221 | 224 | s.heapUpdated = true |
| 222 | 225 | delete(s.waitBars, bf.bar) |
| 223 | 226 | } |
| 227 | // defer is required to make removeOnComplete visually happen | |
| 224 | 228 | defer func() { |
| 225 | 229 | s.shutdownPending = append(s.shutdownPending, bf.bar) |
| 226 | 230 | }() |