Codebase list golang-github-vbauerster-mpb / b39842c
check if bar is running with single call Vladimir Bauer 4 years ago
1 changed file(s) with 13 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
406406 func (b *Bar) forceRefresh() {
407407 var anyOtherRunning bool
408408 b.container.traverseBars(func(bar *Bar) bool {
409 anyOtherRunning = b != bar && !bar.Completed() && !bar.Aborted()
409 anyOtherRunning = b != bar && bar.isRunning()
410410 return !anyOtherRunning
411411 })
412412 if !anyOtherRunning {
418418 return
419419 }
420420 }
421 }
422 }
423
424 func (b *Bar) isRunning() bool {
425 result := make(chan bool)
426 select {
427 case b.operateState <- func(s *bState) {
428 result <- !s.completed && !s.aborted
429 }:
430 return <-result
431 case <-b.done:
432 return false
421433 }
422434 }
423435