Codebase list golang-github-vbauerster-mpb / c31e10e
run shutdownListeners concurrently Vladimir Bauer 1 year, 10 months ago
1 changed file(s) with 8 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
423423 case op := <-b.operateState:
424424 op(bs)
425425 case <-b.ctx.Done():
426 shutdownListeners := bs.shutdownListeners
426 for _, d := range bs.shutdownListeners {
427 b.container.bwg.Add(1)
428 d := d
429 go func() {
430 d.OnShutdown()
431 b.container.bwg.Done()
432 }()
433 }
427434 bs.aborted = !bs.completed()
428435 b.bs = bs
429436 close(b.bsOk)
430 for _, d := range shutdownListeners {
431 d.OnShutdown()
432 }
433437 b.container.bwg.Done()
434438 return
435439 }