Codebase list golang-github-vbauerster-mpb / 84244c9
minor: move pub method to top Vladimir Bauer 3 years ago
1 changed file(s) with 14 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
375375 }
376376 }
377377
378 // IsRunning reports whether the bar is running, i.e. not yet completed
379 // and not yet aborted.
380 func (b *Bar) IsRunning() bool {
381 result := make(chan bool)
382 select {
383 case b.operateState <- func(s *bState) {
384 result <- !s.completed && !s.aborted
385 }:
386 return <-result
387 case <-b.done:
388 return false
389 }
390 }
391
378392 // Wait blocks until bar is completed or aborted.
379393 func (b *Bar) Wait() {
380394 <-b.done
455469 }
456470 }
457471
458 // IsRunning reports whether the bar is running, i.e. not yet completed
459 // and not yet aborted.
460 func (b *Bar) IsRunning() bool {
461 result := make(chan bool)
462 select {
463 case b.operateState <- func(s *bState) {
464 result <- !s.completed && !s.aborted
465 }:
466 return <-result
467 case <-b.done:
468 return false
469 }
470 }
471
472472 func (b *Bar) wSyncTable() [][]chan int {
473473 result := make(chan [][]chan int)
474474 select {