diff --git a/bar.go b/bar.go index 22935a1..82ba69e 100644 --- a/bar.go +++ b/bar.go @@ -61,8 +61,10 @@ rev bool } - afterBar *Bar // key for (*pState).queueBars - sync bool + wait struct { + bar *Bar // key for (*pState).queueBars + sync bool + } } type renderFrame struct { @@ -342,8 +344,8 @@ func (b *Bar) serve(ctx context.Context, bs *bState) { defer b.container.bwg.Done() - if bs.afterBar != nil && bs.sync { - bs.afterBar.Wait() + if bs.wait.bar != nil && bs.wait.sync { + bs.wait.bar.Wait() } for { select { diff --git a/bar_option.go b/bar_option.go index 9e0b9d8..d2233d4 100644 --- a/bar_option.go +++ b/bar_option.go @@ -69,8 +69,8 @@ return nil } return func(s *bState) { - s.afterBar = bar - s.sync = sync + s.wait.bar = bar + s.wait.sync = sync } } diff --git a/progress.go b/progress.go index 20a1d0b..ea5a0c1 100644 --- a/progress.go +++ b/progress.go @@ -119,8 +119,8 @@ case p.operateState <- func(ps *pState) { bs := ps.makeBarState(total, filler, options...) bar := newBar(p, bs) - if bs.afterBar != nil { - ps.queueBars[bs.afterBar] = bar + if bs.wait.bar != nil { + ps.queueBars[bs.wait.bar] = bar } else { heap.Push(&ps.bHeap, bar) ps.heapUpdated = true