diff --git a/bar.go b/bar.go index 34f6722..3b83508 100644 --- a/bar.go +++ b/bar.go @@ -267,18 +267,20 @@ // if bar is already in complete state. If drop is true bar will be // removed as well. func (b *Bar) Abort(drop bool) { - if b.Completed() { - return - } - select { - case <-b.done: - default: + select { + case b.operateState <- func(s *bState) { + if s.completed == true { + return + } if drop { b.container.dropBar(b) - } else if b.container.BarCount() == 1 { + } else { b.container.refreshCh <- time.Now() } b.cancel() + }: + <-b.done + case <-b.done: } }