Skip to content

Commit

Permalink
Fix race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
ioppermann committed Jan 15, 2024
1 parent 4bffbea commit 0bd1188
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions process/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -589,15 +589,19 @@ func (p *process) stop(wait bool) error {
p.callbacks.onExit = func() {
wg.Done()

p.callbacks.lock.Lock()
p.callbacks.onExit = nil
p.callbacks.lock.Unlock()
}
} else {
cb := p.callbacks.onExit
p.callbacks.onExit = func() {
cb()
wg.Done()

p.callbacks.lock.Lock()
p.callbacks.onExit = cb
p.callbacks.lock.Unlock()
}
}
p.callbacks.lock.Unlock()
Expand Down

0 comments on commit 0bd1188

Please sign in to comment.