| ... | ... |
@@ -117,6 +117,7 @@ func (runtime *Runtime) Load(id string) (*Container, error) {
|
| 117 | 117 |
if err := container.FromDisk(); err != nil {
|
| 118 | 118 |
return nil, err |
| 119 | 119 |
} |
| 120 |
+ container.State.initLock() |
|
| 120 | 121 |
if container.Id != id {
|
| 121 | 122 |
return container, fmt.Errorf("Container %s is stored at %s", container.Id, id)
|
| 122 | 123 |
} |
| ... | ... |
@@ -39,9 +39,11 @@ func (s *State) setStopped(exitCode int) {
|
| 39 | 39 |
s.broadcast() |
| 40 | 40 |
} |
| 41 | 41 |
|
| 42 |
-func (s *State) resetLock() {
|
|
| 43 |
- s.stateChangeLock = &sync.Mutex{}
|
|
| 44 |
- s.stateChangeCond = sync.NewCond(s.stateChangeLock) |
|
| 42 |
+func (s *State) initLock() {
|
|
| 43 |
+ if s.stateChangeLock == nil {
|
|
| 44 |
+ s.stateChangeLock = &sync.Mutex{}
|
|
| 45 |
+ s.stateChangeCond = sync.NewCond(s.stateChangeLock) |
|
| 46 |
+ } |
|
| 45 | 47 |
} |
| 46 | 48 |
|
| 47 | 49 |
func (s *State) broadcast() {
|