summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastiaan van Stijn <github@gone.nl>2016-09-20 13:09:18 +0200
committerSebastiaan van Stijn <github@gone.nl>2016-09-20 13:09:18 +0200
commita28c389da109808c5b39da02fdfd24b9e36137fe (patch)
tree9554bf9f9ef5d7672fce82d1a1a03a40b34dab57
parentfe0d7e0799f20af220f7da18d17c26cd6ec871b7 (diff)
downloaddocker-a28c389da109808c5b39da02fdfd24b9e36137fe.tar.gz
Removed unused state functions
This removes the SetStoppedLocking, and SetRestartingLocking functions, which were not used anywhere. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
-rw-r--r--container/state.go19
-rw-r--r--container/state_test.go8
2 files changed, 8 insertions, 19 deletions
diff --git a/container/state.go b/container/state.go
index 12b22a4026..2628fc5b43 100644
--- a/container/state.go
+++ b/container/state.go
@@ -156,7 +156,7 @@ func wait(waitChan <-chan struct{}, timeout time.Duration) error {
// WaitStop waits until state is stopped. If state already stopped it returns
// immediately. If you want wait forever you must supply negative timeout.
-// Returns exit code, that was passed to SetStoppedLocking
+// Returns exit code, that was passed to SetStopped
func (s *State) WaitStop(timeout time.Duration) (int, error) {
s.Lock()
if !s.Running {
@@ -243,13 +243,6 @@ func (s *State) SetRunning(pid int, initial bool) {
}
}
-// SetStoppedLocking locks the container state and sets it to "stopped".
-func (s *State) SetStoppedLocking(exitStatus *ExitStatus) {
- s.Lock()
- s.SetStopped(exitStatus)
- s.Unlock()
-}
-
// SetStopped sets the container state to "stopped" without locking.
func (s *State) SetStopped(exitStatus *ExitStatus) {
s.Running = false
@@ -262,15 +255,7 @@ func (s *State) SetStopped(exitStatus *ExitStatus) {
s.waitChan = make(chan struct{})
}
-// SetRestartingLocking is when docker handles the auto restart of containers when they are
-// in the middle of a stop and being restarted again
-func (s *State) SetRestartingLocking(exitStatus *ExitStatus) {
- s.Lock()
- s.SetRestarting(exitStatus)
- s.Unlock()
-}
-
-// SetRestarting sets the container state to "restarting".
+// SetRestarting sets the container state to "restarting" without locking.
// It also sets the container PID to 0.
func (s *State) SetRestarting(exitStatus *ExitStatus) {
// we should consider the container running when it is restarting because of
diff --git a/container/state_test.go b/container/state_test.go
index f10de12f2a..2e15bd7f41 100644
--- a/container/state_test.go
+++ b/container/state_test.go
@@ -30,7 +30,9 @@ func TestStateRunStop(t *testing.T) {
atomic.StoreInt64(&exit, int64(exitCode))
close(stopped)
}()
- s.SetStoppedLocking(&ExitStatus{ExitCode: i})
+ s.Lock()
+ s.SetStopped(&ExitStatus{ExitCode: i})
+ s.Unlock()
if s.IsRunning() {
t.Fatal("State is running")
}
@@ -70,7 +72,9 @@ func TestStateTimeoutWait(t *testing.T) {
t.Log("Stop callback fired")
}
- s.SetStoppedLocking(&ExitStatus{ExitCode: 1})
+ s.Lock()
+ s.SetStopped(&ExitStatus{ExitCode: 1})
+ s.Unlock()
stopped = make(chan struct{})
go func() {