Skip to content

Commit

Permalink
progressAsWriter example without break quit
Browse files Browse the repository at this point in the history
  • Loading branch information
vbauerster committed Aug 16, 2024
1 parent 511299b commit fe6ed33
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions _examples/progressAsWriter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,19 @@ func main() {
var qwg sync.WaitGroup
qwg.Add(1)
go func() {
quit:
defer qwg.Done()
for {
select {
case <-done:
// after done, underlying io.Writer returns mpb.DoneError
// so following isn't printed
log.Println("all done")
break quit
return
default:
log.Println("waiting for done")
time.Sleep(150 * time.Millisecond)
}
}
qwg.Done()
}()

bwg.Wait()
Expand Down

0 comments on commit fe6ed33

Please sign in to comment.