summaryrefslogtreecommitdiff
path: root/vendor/github.com/vbauerster/mpb/v7/bar.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-09-09 14:19:21 +0200
committerValentin Rothberg <rothberg@redhat.com>2021-09-09 14:19:21 +0200
commit78c5a47fc9443f60d8bc75aff40dbdb4d9d32dc6 (patch)
treea3670ef485ff097c17bda2742202dfe33475a97d /vendor/github.com/vbauerster/mpb/v7/bar.go
parent32eaf347e1e9eb752493b339499aa9fa8777af3d (diff)
downloadpodman-78c5a47fc9443f60d8bc75aff40dbdb4d9d32dc6.tar.gz
podman-78c5a47fc9443f60d8bc75aff40dbdb4d9d32dc6.tar.bz2
podman-78c5a47fc9443f60d8bc75aff40dbdb4d9d32dc6.zip
vendor mpb@v7.1.4
Fixes a race condition leading to a deadlock. Thanks to @mtrmac and @vbauerster for fixing the issue! Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'vendor/github.com/vbauerster/mpb/v7/bar.go')
-rw-r--r--vendor/github.com/vbauerster/mpb/v7/bar.go38
1 files changed, 19 insertions, 19 deletions
diff --git a/vendor/github.com/vbauerster/mpb/v7/bar.go b/vendor/github.com/vbauerster/mpb/v7/bar.go
index 95d4439f8..22f608317 100644
--- a/vendor/github.com/vbauerster/mpb/v7/bar.go
+++ b/vendor/github.com/vbauerster/mpb/v7/bar.go
@@ -268,32 +268,32 @@ func (b *Bar) SetPriority(priority int) {
// if bar is already in complete state. If drop is true bar will be
// removed as well.
func (b *Bar) Abort(drop bool) {
- if drop {
- b.container.dropBar(b) // It is safe to call this multiple times with the same bar
- }
select {
case b.operateState <- func(s *bState) {
if s.completed == true {
return
}
if drop {
- b.cancel()
- return
- }
- go func() {
- var uncompleted int
- b.container.traverseBars(func(bar *Bar) bool {
- if b != bar && !bar.Completed() {
- uncompleted++
- return false
+ go b.container.dropBar(b)
+ } else {
+ go func() {
+ var uncompleted int
+ b.container.traverseBars(func(bar *Bar) bool {
+ if b != bar && !bar.Completed() {
+ uncompleted++
+ return false
+ }
+ return true
+ })
+ if uncompleted == 0 {
+ select {
+ case b.container.refreshCh <- time.Now():
+ case <-b.container.done:
+ }
}
- return true
- })
- if uncompleted == 0 {
- b.container.refreshCh <- time.Now()
- }
- b.cancel()
- }()
+ }()
+ }
+ b.cancel()
}:
<-b.done
case <-b.done: