Codebase list golang-github-vbauerster-mpb / cff94a3
make result chan inside wSyncTable there is no win in keeping it on bar instance. Vladimir Bauer 4 years ago
1 changed file(s) with 4 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
2525 hasEwmaDecorators bool
2626 operateState chan func(*bState)
2727 frameCh chan *frame
28 syncTableCh chan [][]chan int
2928
3029 // cancel is called either by user or on complete event
3130 cancel func()
9089 noPop: bs.noPop,
9190 operateState: make(chan func(*bState)),
9291 frameCh: make(chan *frame, 1),
93 syncTableCh: make(chan [][]chan int, 1),
9492 done: make(chan struct{}),
9593 cancel: cancel,
9694 dlogger: log.New(bs.debugOut, logPrefix, log.Lshortfile),
383381 }
384382
385383 func (b *Bar) wSyncTable() [][]chan int {
386 select {
387 case b.operateState <- func(s *bState) { b.syncTableCh <- s.wSyncTable() }:
388 return <-b.syncTableCh
384 result := make(chan [][]chan int)
385 select {
386 case b.operateState <- func(s *bState) { result <- s.wSyncTable() }:
387 return <-result
389388 case <-b.done:
390389 return b.cacheState.wSyncTable()
391390 }