Codebase list golang-github-vbauerster-mpb / 007b6a1
better performance Vladimir Bauer 7 years ago
1 changed file(s) with 3 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
105105 operateState: make(chan func(*bState)),
106106 frameCh: make(chan io.Reader, 1),
107107 syncTableCh: make(chan [][]chan int),
108 completed: make(chan bool),
108 completed: make(chan bool, 1),
109109 done: make(chan struct{}),
110110 cancel: cancel,
111111 dlogger: log.New(bs.debugOut, logPrefix, log.Lshortfile),
255255 // Completed reports whether the bar is in completed state.
256256 func (b *Bar) Completed() bool {
257257 select {
258 case completed := <-b.completed:
259 return completed
258 case b.operateState <- func(s *bState) { b.completed <- s.toComplete }:
259 return <-b.completed
260260 case <-b.done:
261261 return true
262262 }
277277 select {
278278 case op := <-b.operateState:
279279 op(s)
280 case b.completed <- s.toComplete:
281280 case <-ctx.Done():
282281 b.cacheState = s
283282 close(b.done)