Fix race in contStore.List
Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
This commit is contained in:
parent
4cf40c968f
commit
0b3fe55442
|
@ -72,9 +72,11 @@ func (c *contStore) Delete(id string) {
|
||||||
|
|
||||||
func (c *contStore) List() []*Container {
|
func (c *contStore) List() []*Container {
|
||||||
containers := new(History)
|
containers := new(History)
|
||||||
|
c.Lock()
|
||||||
for _, cont := range c.s {
|
for _, cont := range c.s {
|
||||||
containers.Add(cont)
|
containers.Add(cont)
|
||||||
}
|
}
|
||||||
|
c.Unlock()
|
||||||
containers.Sort()
|
containers.Sort()
|
||||||
return *containers
|
return *containers
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue