aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/select.go
diff options
context:
space:
mode:
authorCuong Manh Le <cuong.manhle.vn@gmail.com>2022-08-17 14:13:06 +0700
committerGopher Robot <gobot@golang.org>2022-08-17 16:26:22 +0000
commit5b0ce94c07524f910278de1d90e31c5bc0805bbd (patch)
treec2d8f86030d0eacdcbfd2248d66b0121bef458f7 /src/runtime/select.go
parentea6cb02ae54fcf89026a2178720396f1277dd105 (diff)
downloadgo-5b0ce94c07524f910278de1d90e31c5bc0805bbd.tar.xz
runtime: convert g.parkingOnChan to atomic type
Updates #53821 Change-Id: I54de39b984984fb3c160aba5afacb90131fd47c4 Reviewed-on: https://go-review.googlesource.com/c/go/+/424394 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Diffstat (limited to 'src/runtime/select.go')
-rw-r--r--src/runtime/select.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/runtime/select.go b/src/runtime/select.go
index e18b2f14c0..2dd6333fa7 100644
--- a/src/runtime/select.go
+++ b/src/runtime/select.go
@@ -8,7 +8,6 @@ package runtime
import (
"internal/abi"
- "runtime/internal/atomic"
"unsafe"
)
@@ -70,7 +69,7 @@ func selparkcommit(gp *g, _ unsafe.Pointer) bool {
// Mark that it's safe for stack shrinking to occur now,
// because any thread acquiring this G's stack for shrinking
// is guaranteed to observe activeStackChans after this store.
- atomic.Store8(&gp.parkingOnChan, 0)
+ gp.parkingOnChan.Store(false)
// Make sure we unlock after setting activeStackChans and
// unsetting parkingOnChan. The moment we unlock any of the
// channel locks we risk gp getting readied by a channel operation
@@ -324,7 +323,7 @@ func selectgo(cas0 *scase, order0 *uint16, pc0 *uintptr, nsends, nrecvs int, blo
// to park on a channel. The window between when this G's status
// changes and when we set gp.activeStackChans is not safe for
// stack shrinking.
- atomic.Store8(&gp.parkingOnChan, 1)
+ gp.parkingOnChan.Store(true)
gopark(selparkcommit, nil, waitReasonSelect, traceEvGoBlockSelect, 1)
gp.activeStackChans = false