netpollInited atomic.Uint32
pollcache pollCache
- netpollWaiters uint32
+ netpollWaiters atomic.Uint32
)
//go:linkname poll_runtime_pollServerInit internal/poll.runtime_pollServerInit
// Bump the count of goroutines waiting for the poller.
// The scheduler uses this to decide whether to block
// waiting for the poller if there is nothing else to do.
- atomic.Xadd(&netpollWaiters, 1)
+ netpollWaiters.Add(1)
}
return r
}
func netpollgoready(gp *g, traceskip int) {
- atomic.Xadd(&netpollWaiters, -1)
+ netpollWaiters.Add(-1)
goready(gp, traceskip+1)
}
import "runtime/internal/atomic"
var netpollInited atomic.Uint32
-var netpollWaiters uint32
+var netpollWaiters atomic.Uint32
var netpollStubLock mutex
var netpollNote note
// 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)
}
// 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")
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