Remove flushed ch
Vladimir Bauer
8 years ago
| 276 | 276 |
}
|
| 277 | 277 |
}
|
| 278 | 278 |
|
| 279 | |
func (b *Bar) render(tw int, flushed chan struct{}, prependWs, appendWs *widthSync) <-chan []byte {
|
|
279 |
func (b *Bar) render(tw int, prependWs, appendWs *widthSync) <-chan []byte {
|
| 280 | 280 |
ch := make(chan []byte)
|
| 281 | 281 |
|
| 282 | 282 |
go func() {
|
|
| 291 | 291 |
select {
|
| 292 | 292 |
case b.ops <- func(s *state) {
|
| 293 | 293 |
if s.completed {
|
| 294 | |
fmt.Fprintln(os.Stderr, "bar completed")
|
| 295 | |
// <-flushed
|
| 296 | 294 |
b.Complete()
|
| 297 | 295 |
}
|
| 298 | 296 |
result <- *s
|
| 213 | 213 |
|
| 214 | 214 |
tw, _, _ := cwriter.GetTermSize()
|
| 215 | 215 |
|
| 216 | |
flushed := make(chan struct{})
|
| 217 | 216 |
sequence := make([]<-chan []byte, numBars)
|
| 218 | 217 |
for i, b := range conf.bars {
|
| 219 | |
sequence[i] = b.render(tw, flushed, prependWs, appendWs)
|
|
218 |
sequence[i] = b.render(tw, prependWs, appendWs)
|
| 220 | 219 |
}
|
| 221 | 220 |
|
| 222 | 221 |
for buf := range fanIn(sequence...) {
|
|
| 228 | 227 |
}
|
| 229 | 228 |
|
| 230 | 229 |
conf.cw.Flush()
|
| 231 | |
close(flushed)
|
| 232 | 230 |
case <-conf.cancel:
|
| 233 | 231 |
conf.ticker.Stop()
|
| 234 | 232 |
conf.cancel = nil
|