diff --git a/bar.go b/bar.go index 143e828..c1bffa6 100644 --- a/bar.go +++ b/bar.go @@ -305,13 +305,11 @@ }() result := make(chan state, 1) select { - case b.ops <- func(s *state) { - if s.completed { + case b.ops <- func(s *state) { result <- *s }: + st = <-result + if st.completed { b.Complete() } - result <- *s - }: - st = <-result case <-b.done: st = b.cacheState }