Codebase list golang-github-vbauerster-mpb / c06fcdf
refactoring defer wg.Wait inside flush Vladimir Bauer 3 years ago
1 changed file(s) with 6 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
305305 go b.render(width)
306306 }
307307
308 return s.flush(cw, height)
309 }
310
311 func (s *pState) flush(cw *cwriter.Writer, height int) error {
308312 wg := new(sync.WaitGroup)
309 err = s.flush(wg, cw, height)
310 wg.Wait()
311 return err
312 }
313
314 func (s *pState) flush(wg *sync.WaitGroup, cw *cwriter.Writer, height int) error {
313 defer wg.Wait() // waiting for all s.hm.push to complete
314
315315 var popCount int
316316 s.rows = s.rows[:0]
317317