mirror of
https://github.com/containers/podman.git
synced 2025-06-20 00:51:16 +08:00
Merge pull request #10466 from vrothberg/fix-10459
libimage-events channel: fix data race
This commit is contained in:
@ -217,8 +217,6 @@ func newRuntimeFromConfig(ctx context.Context, conf *config.Config, options ...R
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
runtime.libimageEventsShutdown = make(chan bool)
|
|
||||||
|
|
||||||
return runtime, nil
|
return runtime, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -701,6 +699,8 @@ var libimageEventsMap = map[libimage.EventType]events.Status{
|
|||||||
// events on the libimage.Runtime. The gourtine will be cleaned up implicitly
|
// events on the libimage.Runtime. The gourtine will be cleaned up implicitly
|
||||||
// when the main() exists.
|
// when the main() exists.
|
||||||
func (r *Runtime) libimageEvents() {
|
func (r *Runtime) libimageEvents() {
|
||||||
|
r.libimageEventsShutdown = make(chan bool)
|
||||||
|
|
||||||
toLibpodEventStatus := func(e *libimage.Event) events.Status {
|
toLibpodEventStatus := func(e *libimage.Event) events.Status {
|
||||||
status, found := libimageEventsMap[e.Type]
|
status, found := libimageEventsMap[e.Type]
|
||||||
if !found {
|
if !found {
|
||||||
@ -780,7 +780,9 @@ func (r *Runtime) Shutdown(force bool) error {
|
|||||||
// attempt to shut it down
|
// attempt to shut it down
|
||||||
if r.store != nil {
|
if r.store != nil {
|
||||||
// Wait for the events to be written.
|
// Wait for the events to be written.
|
||||||
r.libimageEventsShutdown <- true
|
if r.libimageEventsShutdown != nil {
|
||||||
|
r.libimageEventsShutdown <- true
|
||||||
|
}
|
||||||
|
|
||||||
// Note that the libimage runtime shuts down the store.
|
// Note that the libimage runtime shuts down the store.
|
||||||
if err := r.libimageRuntime.Shutdown(force); err != nil {
|
if err := r.libimageRuntime.Shutdown(force); err != nil {
|
||||||
|
Reference in New Issue
Block a user