aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/proc.go
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2022-07-14 16:58:25 -0400
committerMichael Pratt <mpratt@google.com>2022-08-12 01:31:57 +0000
commit40fa2dabe0ee3a163c338dab1ea6036037287507 (patch)
treea12db6097a2d8213da0f4a6b356456e26112b9a7 /src/runtime/proc.go
parenta5cd894318677359f6d07ee74f9004d28b4d164c (diff)
downloadgo-40fa2dabe0ee3a163c338dab1ea6036037287507.tar.xz
runtime: convert pendingPreemptSignals to atomic type
For #53821. Change-Id: I106adbcb00b7b887d54001c2d7d97345a13cc662 Reviewed-on: https://go-review.googlesource.com/c/go/+/419436 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com> Auto-Submit: Michael Pratt <mpratt@google.com> Run-TryBot: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/runtime/proc.go')
-rw-r--r--src/runtime/proc.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/runtime/proc.go b/src/runtime/proc.go
index 32782b3c65..cea7f37d13 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -1547,7 +1547,7 @@ found:
// Make sure pendingPreemptSignals is correct when an M exits.
// For #41702.
if atomic.Load(&mp.signalPending) != 0 {
- atomic.Xadd(&pendingPreemptSignals, -1)
+ pendingPreemptSignals.Add(-1)
}
}
@@ -4036,7 +4036,7 @@ func syscall_runtime_AfterForkInChild() {
// pendingPreemptSignals is the number of preemption signals
// that have been sent but not received. This is only used on Darwin.
// For #41702.
-var pendingPreemptSignals uint32
+var pendingPreemptSignals atomic.Int32
// Called from syscall package before Exec.
//
@@ -4048,7 +4048,7 @@ func syscall_runtime_BeforeExec() {
// On Darwin, wait for all pending preemption signals to
// be received. See issue #41702.
if GOOS == "darwin" || GOOS == "ios" {
- for int32(atomic.Load(&pendingPreemptSignals)) > 0 {
+ for pendingPreemptSignals.Load() > 0 {
osyield()
}
}