Codebase list golang-github-vbauerster-mpb / 24934da
abandon width sync after rr passed Vladimir Bauer 9 years ago
1 changed file(s) with 4 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
274274 beforeRender(bars)
275275 }
276276
277 stopWidthListen := make(chan struct{})
278 prependWs := newWidthSync(stopWidthListen, numBars, bars[0].NumOfPrependers())
279 appendWs := newWidthSync(stopWidthListen, numBars, bars[0].NumOfAppenders())
277 prependWs := newWidthSync(numBars, bars[0].NumOfPrependers())
278 appendWs := newWidthSync(numBars, bars[0].NumOfAppenders())
280279
281280 width, _, _ := cwriter.GetTermSize()
282281 ibars := iBarsGen(bars, width)
291290 go func() {
292291 wg.Wait()
293292 close(ibbCh)
294 close(stopWidthListen)
295293 for _, ch := range prependWs.listen {
296294 close(ch)
297295 }
322320 }
323321 }
324322
325 func newWidthSync(stopListen chan struct{}, numBars, numColumn int) *widthSync {
323 func newWidthSync(numBars, numColumn int) *widthSync {
326324 ws := &widthSync{
327325 listen: make([]chan int, numColumn),
328326 result: make([]chan int, numColumn),
343341 if len(widths) == numBars {
344342 break loop
345343 }
346 case <-stopListen:
344 case <-time.After(rr * time.Millisecond):
347345 return
348346 }
349347 }