mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #19447 from sillyousu/19407-fix-exec-store-data-race
Fix race condition in execCommandGC
This commit is contained in:
commit
bdcc3ebe41
1 changed files with 7 additions and 1 deletions
|
@ -53,7 +53,13 @@ func NewStore() *Store {
|
|||
|
||||
// Commands returns the exec configurations in the store.
|
||||
func (e *Store) Commands() map[string]*Config {
|
||||
return e.commands
|
||||
e.RLock()
|
||||
commands := make(map[string]*Config, len(e.commands))
|
||||
for id, config := range e.commands {
|
||||
commands[id] = config
|
||||
}
|
||||
e.RUnlock()
|
||||
return commands
|
||||
}
|
||||
|
||||
// Add adds a new exec configuration to the store.
|
||||
|
|
Loading…
Reference in a new issue