mirror of
https://github.com/docker/docs.git
synced 2026-03-27 14:28:47 +07:00
State: Keep track of the container start time
This commit is contained in:
3
state.go
3
state.go
@@ -2,12 +2,14 @@ package docker
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
type State struct {
|
||||
Running bool
|
||||
Pid int
|
||||
ExitCode int
|
||||
StartedAt time.Time
|
||||
|
||||
stateChangeLock *sync.Mutex
|
||||
stateChangeCond *sync.Cond
|
||||
@@ -25,6 +27,7 @@ func (s *State) setRunning(pid int) {
|
||||
s.Running = true
|
||||
s.ExitCode = 0
|
||||
s.Pid = pid
|
||||
s.StartedAt = time.Now()
|
||||
s.broadcast()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user