Merge pull request #26695 from AkihiroSuda/fix-pause-race
Fix a race in libcontainerd/pausemonitor_linux.go Upstream-commit: 622faab3f64e0e446753c8e9c5f5e7d3d82ec045 Component: engine
This commit is contained in:
@ -1,11 +1,18 @@
|
||||
package libcontainerd
|
||||
|
||||
import (
|
||||
"sync"
|
||||
)
|
||||
|
||||
// pauseMonitor is helper to get notifications from pause state changes.
|
||||
type pauseMonitor struct {
|
||||
sync.Mutex
|
||||
waiters map[string][]chan struct{}
|
||||
}
|
||||
|
||||
func (m *pauseMonitor) handle(t string) {
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
if m.waiters == nil {
|
||||
return
|
||||
}
|
||||
@ -20,6 +27,8 @@ func (m *pauseMonitor) handle(t string) {
|
||||
}
|
||||
|
||||
func (m *pauseMonitor) append(t string, waiter chan struct{}) {
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
if m.waiters == nil {
|
||||
m.waiters = make(map[string][]chan struct{})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user