aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCuong Manh Le <cuong.manhle.vn@gmail.com>2022-08-17 17:28:58 +0700
committerCuong Manh Le <cuong.manhle.vn@gmail.com>2022-08-17 17:47:28 +0000
commit7e7ecf5cbbd5c0b61e693a65c865bf372fc2ea80 (patch)
treec6db319cd0a69675757eda94f1c6fb3e79d6031f /src
parent5e20f2e4dfdfea7deb9ad9e2a9909a32588334a0 (diff)
downloadgo-7e7ecf5cbbd5c0b61e693a65c865bf372fc2ea80.tar.xz
runtime: convert freezing to atomic type
Updates #53821 Change-Id: I77fcdb972b8920e1fb42248ce5bd2c3d2d0bd27e Reviewed-on: https://go-review.googlesource.com/c/go/+/423885 Reviewed-by: Michael Pratt <mpratt@google.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Diffstat (limited to 'src')
-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 0e74eb1075..b57644cc21 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -868,13 +868,13 @@ const freezeStopWait = 0x7fffffff
// freezing is set to non-zero if the runtime is trying to freeze the
// world.
-var freezing uint32
+var freezing atomic.Bool
// Similar to stopTheWorld but best-effort and can be called several times.
// There is no reverse operation, used during crashing.
// This function must not lock any mutexes.
func freezetheworld() {
- atomic.Store(&freezing, 1)
+ freezing.Store(true)
// stopwait and preemption requests can be lost
// due to races with concurrently executing threads,
// so try several times
@@ -1240,7 +1240,7 @@ func stopTheWorldWithSema() {
}
}
}
- if atomic.Load(&freezing) != 0 {
+ if freezing.Load() {
// Some other thread is panicking. This can cause the
// sanity checks above to fail if the panic happens in
// the signal handler on a stopped thread. Either way,