From d1015f3e58e50c3e6f958391a9174fc15e030e83 Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Fri, 26 Jun 2020 11:57:08 -0400 Subject: [PATCH] runtime: don't preempt if preemption is disabled 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 Reviewed-by: Keith Randall TryBot-Result: Gobot Gobot --- src/runtime/signal_unix.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/signal_unix.go b/src/runtime/signal_unix.go index ba3e21ae2e..dd6d79f8ec 100644 --- a/src/runtime/signal_unix.go +++ b/src/runtime/signal_unix.go @@ -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 -- 2.50.0