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>
This commit is contained in:
Michael Pratt 2022-07-14 16:58:25 -04:00
parent a5cd894318
commit 40fa2dabe0
2 changed files with 6 additions and 6 deletions

View file

@ -353,7 +353,7 @@ func doSigPreempt(gp *g, ctxt *sigctxt) {
atomic.Store(&gp.m.signalPending, 0)
if GOOS == "darwin" || GOOS == "ios" {
atomic.Xadd(&pendingPreemptSignals, -1)
pendingPreemptSignals.Add(-1)
}
}
@ -374,7 +374,7 @@ func preemptM(mp *m) {
if atomic.Cas(&mp.signalPending, 0, 1) {
if GOOS == "darwin" || GOOS == "ios" {
atomic.Xadd(&pendingPreemptSignals, 1)
pendingPreemptSignals.Add(1)
}
// If multiple threads are preempting the same M, it may send many
@ -453,7 +453,7 @@ func sigtrampgo(sig uint32, info *siginfo, ctx unsafe.Pointer) {
// The default behavior for sigPreempt is to ignore
// the signal, so badsignal will be a no-op anyway.
if GOOS == "darwin" || GOOS == "ios" {
atomic.Xadd(&pendingPreemptSignals, -1)
pendingPreemptSignals.Add(-1)
}
return
}