mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: convert m.signalPending to atomic type
Updates #53821 Change-Id: Ib455be9ca7120ded7c77d34556eff977aa61faa3 Reviewed-on: https://go-review.googlesource.com/c/go/+/423886 Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Keith Randall <khr@google.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
014f0e8205
commit
b11b4b4de3
3 changed files with 4 additions and 5 deletions
|
|
@ -350,7 +350,7 @@ func doSigPreempt(gp *g, ctxt *sigctxt) {
|
|||
|
||||
// Acknowledge the preemption.
|
||||
atomic.Xadd(&gp.m.preemptGen, 1)
|
||||
atomic.Store(&gp.m.signalPending, 0)
|
||||
gp.m.signalPending.Store(0)
|
||||
|
||||
if GOOS == "darwin" || GOOS == "ios" {
|
||||
pendingPreemptSignals.Add(-1)
|
||||
|
|
@ -372,7 +372,7 @@ func preemptM(mp *m) {
|
|||
execLock.rlock()
|
||||
}
|
||||
|
||||
if atomic.Cas(&mp.signalPending, 0, 1) {
|
||||
if mp.signalPending.CompareAndSwap(0, 1) {
|
||||
if GOOS == "darwin" || GOOS == "ios" {
|
||||
pendingPreemptSignals.Add(1)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue