diff options
| author | Michael Pratt <mpratt@google.com> | 2022-07-29 14:52:42 -0400 |
|---|---|---|
| committer | Michael Pratt <mpratt@google.com> | 2022-08-12 01:53:29 +0000 |
| commit | 3121c2bf64ae7e5c17379af2cf2a5c16952f57f1 (patch) | |
| tree | 4af594226aa76d6d4a242a1e68ee107a41bfdbd2 /src/runtime/proc.go | |
| parent | b04e4637dba254e5bda132753a91532f8e32e4b9 (diff) | |
| download | go-3121c2bf64ae7e5c17379af2cf2a5c16952f57f1.tar.xz | |
runtime: convert prof.signalLock to atomic type
For #53821.
Change-Id: I3e757fc6a020be10ee69459c395cb7eee49b0dfb
Reviewed-on: https://go-review.googlesource.com/c/go/+/420195
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/runtime/proc.go')
| -rw-r--r-- | src/runtime/proc.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/runtime/proc.go b/src/runtime/proc.go index c3144b4dde..a673e45071 100644 --- a/src/runtime/proc.go +++ b/src/runtime/proc.go @@ -4474,7 +4474,7 @@ func mcount() int32 { } var prof struct { - signalLock uint32 + signalLock atomic.Uint32 hz int32 } @@ -4628,14 +4628,14 @@ func setcpuprofilerate(hz int32) { // it would deadlock. setThreadCPUProfiler(0) - for !atomic.Cas(&prof.signalLock, 0, 1) { + for !prof.signalLock.CompareAndSwap(0, 1) { osyield() } if prof.hz != hz { setProcessCPUProfiler(hz) prof.hz = hz } - atomic.Store(&prof.signalLock, 0) + prof.signalLock.Store(0) lock(&sched.lock) sched.profilehz = hz |
