]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: sleep longer in dieFromSignal on Darwin
authorIan Lance Taylor <iant@golang.org>
Thu, 7 Dec 2017 00:24:10 +0000 (16:24 -0800)
committerIan Lance Taylor <iant@golang.org>
Thu, 7 Dec 2017 00:56:23 +0000 (00:56 +0000)
Fixes #20315

Change-Id: I5d5c82f10902b59168fc0cca0af50286843df55d
Reviewed-on: https://go-review.googlesource.com/82375
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/runtime/signal_unix.go

index 2cd3d7180049c3d41afc6ce7eaf99119b9f51866..ac191f302fac419b71c3dacf73fa10c14d53d98c 100644 (file)
@@ -432,6 +432,14 @@ func dieFromSignal(sig uint32) {
        osyield()
        osyield()
 
+       // On Darwin we may still fail to die, because raise sends the
+       // signal to the whole process rather than just the current thread,
+       // and osyield just sleeps briefly rather than letting all other
+       // threads run. See issue 20315. Sleep longer.
+       if GOOS == "darwin" {
+               usleep(100)
+       }
+
        // If we are still somehow running, just exit with the wrong status.
        exit(2)
 }