Skip to content

Commit

Permalink
Fix race condition in sending started signal from monitor
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com>
  • Loading branch information
LK4D4 committed Aug 14, 2014
1 parent 1711270 commit 1480168
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions daemon/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,12 @@ func (m *containerMonitor) callback(command *execdriver.Command) {

m.container.State.SetRunning(command.Pid())

if m.startSignal != nil {
// signal that the process has started
// signal that the process has started
// close channel only if not closed
select {
case <-m.startSignal:
default:
close(m.startSignal)
m.startSignal = nil
}

if err := m.container.ToDisk(); err != nil {
Expand Down

0 comments on commit 1480168

Please sign in to comment.