aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/proc.go
diff options
context:
space:
mode:
authorAndy Pan <panjf2000@gmail.com>2022-08-25 02:26:08 +0800
committerMichael Pratt <mpratt@google.com>2022-08-25 21:52:20 +0000
commitaab8d2b448c4855a4e4a9c2d477671a75828f78b (patch)
tree1d4b093892dc5fcdfd6c3f5aa4d790899d1cec90 /src/runtime/proc.go
parent73a55c17049a2c12e5368790e178c32363743dd8 (diff)
downloadgo-aab8d2b448c4855a4e4a9c2d477671a75828f78b.tar.xz
runtime: convert netpollWaiters to internal atomic type
Updates #53821 Change-Id: I8776382b3eb0b7752cfc0d9287b707039d3f05c6 Reviewed-on: https://go-review.googlesource.com/c/go/+/425358 Reviewed-by: Michael Pratt <mpratt@google.com> Run-TryBot: hopehook <hopehook@qq.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/runtime/proc.go')
-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 d572fa2215..3038b9819d 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -2659,7 +2659,7 @@ top:
// blocked thread (e.g. it has already returned from netpoll, but does
// not set lastpoll yet), this thread will do blocking netpoll below
// anyway.
- if netpollinited() && atomic.Load(&netpollWaiters) > 0 && sched.lastpoll.Load() != 0 {
+ if netpollinited() && netpollWaiters.Load() > 0 && sched.lastpoll.Load() != 0 {
if list := netpoll(0); !list.empty() { // non-blocking
gp := list.pop()
injectglist(&list)
@@ -2851,7 +2851,7 @@ top:
}
// Poll network until next timer.
- if netpollinited() && (atomic.Load(&netpollWaiters) > 0 || pollUntil != 0) && sched.lastpoll.Swap(0) != 0 {
+ if netpollinited() && (netpollWaiters.Load() > 0 || pollUntil != 0) && sched.lastpoll.Swap(0) != 0 {
sched.pollUntil.Store(pollUntil)
if mp.p != 0 {
throw("findrunnable: netpoll with p")
@@ -2924,7 +2924,7 @@ func pollWork() bool {
if !runqempty(p) {
return true
}
- if netpollinited() && atomic.Load(&netpollWaiters) > 0 && sched.lastpoll.Load() != 0 {
+ if netpollinited() && netpollWaiters.Load() > 0 && sched.lastpoll.Load() != 0 {
if list := netpoll(0); !list.empty() {
injectglist(&list)
return true