mirror of
https://github.com/containers/podman.git
synced 2025-05-17 15:18:43 +08:00

It seems that if some background tasks are queued in libpod's Runtime before the worker's channel is set up (eg. in the refresh phase), they are not executed later on, but the workerGroup's counter is still ticked up. This leads podman to hang when the imageEngine is shutdown, since it waits for the workerGroup to be done. fixes containers/podman#22984 Signed-off-by: Farya Maerten <me@ltow.me>
24 lines
349 B
Go
24 lines
349 B
Go
//go:build !remote
|
|
|
|
package libpod
|
|
|
|
func (r *Runtime) setupWorkerQueue() {
|
|
r.workerChannel = make(chan func(), 10)
|
|
}
|
|
|
|
func (r *Runtime) startWorker() {
|
|
go func() {
|
|
for w := range r.workerChannel {
|
|
w()
|
|
r.workerGroup.Done()
|
|
}
|
|
}()
|
|
}
|
|
|
|
func (r *Runtime) queueWork(f func()) {
|
|
r.workerGroup.Add(1)
|
|
go func() {
|
|
r.workerChannel <- f
|
|
}()
|
|
}
|