mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fix a race in libcontainerd/pausemonitor_linux.go
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
This commit is contained in:
parent
45a8f68026
commit
69f00a137c
1 changed files with 9 additions and 0 deletions
|
@ -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{})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue