]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: don't preempt if preemption is disabled
authorCherry Zhang <cherryyz@google.com>
Fri, 26 Jun 2020 15:57:08 +0000 (11:57 -0400)
committerCherry Zhang <cherryyz@google.com>
Fri, 26 Jun 2020 17:07:58 +0000 (17:07 +0000)
If asyncpreemptoff is set, don't preempt upon receiving a SIGURG.

Fixes #38531.

Change-Id: I6d9a828b45c199d3e479cbdfe17a896a40d540f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/240121
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/runtime/signal_unix.go

index ba3e21ae2eaa60efdc81eac73867917d348e6df0..dd6d79f8ecf5dd2e83b2f8c4eb3d48862ed01c22 100644 (file)
@@ -536,7 +536,7 @@ func sighandler(sig uint32, info *siginfo, ctxt unsafe.Pointer, gp *g) {
                return
        }
 
-       if sig == sigPreempt {
+       if sig == sigPreempt && debug.asyncpreemptoff == 0 {
                // Might be a preemption signal.
                doSigPreempt(gp, c)
                // Even if this was definitely a preemption signal, it