skip abort if bar already in completed state
Vladimir Bauer
4 years ago
| 262 | 262 | b.container.setBarPriority(b, priority) |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | // Abort interrupts bar's running goroutine. Call this, if you'd like | |
| 266 | // to stop/remove bar before completion event. It has no effect after | |
| 267 | // completion event. If drop is true bar will be removed as well. | |
| 265 | // Abort interrupts bar's running goroutine. Abort won't be engaged | |
| 266 | // if bar is already in complete state. If drop is true bar will be | |
| 267 | // removed as well. | |
| 268 | 268 | func (b *Bar) Abort(drop bool) { |
| 269 | if b.Completed() { | |
| 270 | return | |
| 271 | } | |
| 269 | 272 | select { |
| 270 | 273 | case <-b.done: |
| 271 | 274 | default: |