Abort: don't force to wait, instead comment about how to wait
Vladimir Bauer
4 years ago
| 293 | 293 | |
| 294 | 294 | // Abort interrupts bar's running goroutine. Abort won't be engaged |
| 295 | 295 | // if bar is already in complete state. If drop is true bar will be |
| 296 | // removed as well. | |
| 296 | // removed as well. To make sure that bar has been removed call | |
| 297 | // (*Bar).Wait method. | |
| 297 | 298 | func (b *Bar) Abort(drop bool) { |
| 298 | 299 | select { |
| 299 | 300 | case b.operateState <- func(s *bState) { |
| 304 | 305 | s.dropOnComplete = drop |
| 305 | 306 | go b.forceRefresh() |
| 306 | 307 | }: |
| 307 | <-b.done | |
| 308 | 308 | case <-b.done: |
| 309 | 309 | } |
| 310 | 310 | } |