1
0
mirror of https://github.com/docker/cli.git synced 2026-01-15 07:40:57 +03:00

Merge pull request #9543 from ErikDubbelboer/racefix

Removed race condition
Upstream-commit: f91a79e071db20e45fa61e0f606ce944121822c4
Component: engine
This commit is contained in:
Arnaud Porterie
2014-12-06 09:08:36 -08:00

View File

@@ -34,9 +34,8 @@ func Trap(cleanup func()) {
case os.Interrupt, syscall.SIGTERM:
// If the user really wants to interrupt, let him do so.
if atomic.LoadUint32(&interruptCount) < 3 {
atomic.AddUint32(&interruptCount, 1)
// Initiate the cleanup only once
if atomic.LoadUint32(&interruptCount) == 1 {
if atomic.AddUint32(&interruptCount, 1) == 1 {
// Call cleanup handler
cleanup()
os.Exit(0)