diff --git a/_examples/barExtenderRev/main.go b/_examples/barExtenderRev/main.go index 7823e05..d0544c1 100644 --- a/_examples/barExtenderRev/main.go +++ b/_examples/barExtenderRev/main.go @@ -45,7 +45,7 @@ bar := p.AddBar(tasks[i].total, mpb.BarExtender(filler, true), mpb.BarFuncOptional(func() mpb.BarOption { - return mpb.BarQueueAfter(tasks[i-1].bar, false) + return mpb.BarQueueAfter(tasks[i-1].bar) }, i != 0), mpb.PrependDecorators( decor.Name("current:", decor.WCSyncWidthR), diff --git a/_examples/complex/main.go b/_examples/complex/main.go index 39d98e4..8ce73a9 100644 --- a/_examples/complex/main.go +++ b/_examples/complex/main.go @@ -29,7 +29,7 @@ mpb.AppendDecorators(decor.Percentage(decor.WC{W: 5})), ) queue[1] = p.AddBar(rand.Int63n(101)+100, - mpb.BarQueueAfter(queue[0], false), // this bar is queued + mpb.BarQueueAfter(queue[0]), // this bar is queued mpb.BarFillerClearOnComplete(), mpb.PrependDecorators( decor.Name(task, decor.WC{W: len(task) + 1, C: decor.DidentRight}), diff --git a/bar.go b/bar.go index dbb1c0d..08c74d9 100644 --- a/bar.go +++ b/bar.go @@ -52,11 +52,7 @@ filler BarFiller extender extenderFunc refreshCh chan time.Time - - wait struct { - bar *Bar // key for (*pState).queueBars - sync bool - } + waitBar *Bar // key for (*pState).queueBars } type renderFrame struct { @@ -400,9 +396,6 @@ func (b *Bar) serve(ctx context.Context, bs *bState) { defer b.container.bwg.Done() - if bs.wait.bar != nil && bs.wait.sync { - bs.wait.bar.Wait() - } for { select { case op := <-b.operateState: diff --git a/bar_option.go b/bar_option.go index bc389e0..a6f4913 100644 --- a/bar_option.go +++ b/bar_option.go @@ -59,15 +59,9 @@ // BarQueueAfter puts this (being constructed) bar into the queue. // BarPriority will be inherited from the argument bar. // When argument bar completes or aborts queued bar replaces its place. -// If sync is true queued bar is suspended until argument bar completes -// or aborts. -func BarQueueAfter(bar *Bar, sync bool) BarOption { - if bar == nil { - return nil - } - return func(s *bState) { - s.wait.bar = bar - s.wait.sync = sync +func BarQueueAfter(bar *Bar) BarOption { + return func(s *bState) { + s.waitBar = bar } } diff --git a/progress.go b/progress.go index 980717e..fb2ebb1 100644 --- a/progress.go +++ b/progress.go @@ -135,8 +135,8 @@ case p.operateState <- func(ps *pState) { bs := ps.makeBarState(total, filler, options...) bar := newBar(ps.ctx, p, bs) - if bs.wait.bar != nil { - ps.queueBars[bs.wait.bar] = bar + if bs.waitBar != nil { + ps.queueBars[bs.waitBar] = bar } else { ps.hm.push(bar, true) }