Codebase list golang-github-vbauerster-mpb / 183948f
Abort: don't force to wait, instead comment about how to wait Vladimir Bauer 4 years ago
2 changed file(s) with 3 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
293293
294294 // Abort interrupts bar's running goroutine. Abort won't be engaged
295295 // 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.
297298 func (b *Bar) Abort(drop bool) {
298299 select {
299300 case b.operateState <- func(s *bState) {
304305 s.dropOnComplete = drop
305306 go b.forceRefresh()
306307 }:
307 <-b.done
308308 case <-b.done:
309309 }
310310 }
6666 if abortCalledTimes != 1 {
6767 t.Errorf("Expected abortCalledTimes: %d, got: %d\n", 1, abortCalledTimes)
6868 }
69 b.Wait()
6970 count := p.BarCount()
7071 if count != 1 {
7172 t.Errorf("BarCount want: %d, got: %d\n", 1, count)