Codebase list golang-github-vbauerster-mpb / ded3c59
make sure bar is alive, before sending to channels Vladimir Bauer 8 years ago
1 changed file(s) with 7 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
1212 }
1313
1414 func (r *Reader) Read(p []byte) (int, error) {
15 now := time.Now()
16 for _, ch := range r.sbChannels {
17 ch <- now
15 select {
16 case <-r.bar.done:
17 default:
18 now := time.Now()
19 for _, ch := range r.sbChannels {
20 ch <- now
21 }
1822 }
1923 n, err := r.Reader.Read(p)
2024 r.bar.IncrBy(n)