зеркало из https://github.com/microsoft/docker.git
Merge pull request #6214 from LK4D4/fix_some_more_race_conditions
Fix some more race conditions
This commit is contained in:
Коммит
51b188c510
|
@ -808,11 +808,16 @@ func (container *Container) GetPtyMaster() (*os.File, error) {
|
|||
}
|
||||
|
||||
func (container *Container) HostConfig() *runconfig.HostConfig {
|
||||
return container.hostConfig
|
||||
container.Lock()
|
||||
res := container.hostConfig
|
||||
container.Unlock()
|
||||
return res
|
||||
}
|
||||
|
||||
func (container *Container) SetHostConfig(hostConfig *runconfig.HostConfig) {
|
||||
container.Lock()
|
||||
container.hostConfig = hostConfig
|
||||
container.Unlock()
|
||||
}
|
||||
|
||||
func (container *Container) DisableLink(name string) {
|
||||
|
|
|
@ -72,9 +72,11 @@ func (c *contStore) Delete(id string) {
|
|||
|
||||
func (c *contStore) List() []*Container {
|
||||
containers := new(History)
|
||||
c.Lock()
|
||||
for _, cont := range c.s {
|
||||
containers.Add(cont)
|
||||
}
|
||||
c.Unlock()
|
||||
containers.Sort()
|
||||
return *containers
|
||||
}
|
||||
|
|
|
@ -2402,12 +2402,14 @@ func (srv *Server) LogEvent(action, id, from string) *utils.JSONMessage {
|
|||
now := time.Now().UTC().Unix()
|
||||
jm := utils.JSONMessage{Status: action, ID: id, From: from, Time: now}
|
||||
srv.AddEvent(jm)
|
||||
srv.Lock()
|
||||
for _, c := range srv.listeners {
|
||||
select { // non blocking channel
|
||||
case c <- jm:
|
||||
default:
|
||||
}
|
||||
}
|
||||
srv.Unlock()
|
||||
return &jm
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче