From a6ed99059384e8544680186d2a4d1afb1cdbba38 Mon Sep 17 00:00:00 2001 From: Ma Shimiao Date: Thu, 20 Aug 2015 11:08:31 +0800 Subject: [PATCH] daemon/state: separate part of SetRestarting to setRestarting Signed-off-by: Ma Shimiao --- daemon/state.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/daemon/state.go b/daemon/state.go index 861671d7ad..7c48db6501 100644 --- a/daemon/state.go +++ b/daemon/state.go @@ -207,6 +207,11 @@ func (s *State) setStopped(exitStatus *execdriver.ExitStatus) { // in the middle of a stop and being restarted again func (s *State) SetRestarting(exitStatus *execdriver.ExitStatus) { s.Lock() + s.setRestarting(exitStatus) + s.Unlock() +} + +func (s *State) setRestarting(exitStatus *execdriver.ExitStatus) { // we should consider the container running when it is restarting because of // all the checks in docker around rm/stop/etc s.Running = true @@ -217,7 +222,6 @@ func (s *State) SetRestarting(exitStatus *execdriver.ExitStatus) { s.OOMKilled = exitStatus.OOMKilled close(s.waitChan) // fire waiters for stop s.waitChan = make(chan struct{}) - s.Unlock() } // setError sets the container's error state. This is useful when we want to