// mp.curg is now a real goroutine.
casgstatus(mp.curg, _Gdead, _Gsyscall)
- atomic.Xadd(&sched.ngsys, -1)
+ sched.ngsys.Add(-1)
}
var earlycgocallback = []byte("fatal error: cgo callback before cgo call\n")
// counted by gcount. It would be more "proper" to increment
// sched.ngfree, but that requires locking. Incrementing ngsys
// has the same effect.
- atomic.Xadd(&sched.ngsys, +1)
+ sched.ngsys.Add(1)
// Add m to the extra list.
mnext := lockextra(true)
// Return mp.curg to dead state.
casgstatus(mp.curg, _Gsyscall, _Gdead)
mp.curg.preemptStop = false
- atomic.Xadd(&sched.ngsys, +1)
+ sched.ngsys.Add(1)
// Block signals before unminit.
// Unminit unregisters the signal handling stack (but needs g on some systems).
casgstatus(gp, _Grunning, _Gdead)
gcController.addScannableStack(pp, -int64(gp.stack.hi-gp.stack.lo))
if isSystemGoroutine(gp, false) {
- atomic.Xadd(&sched.ngsys, -1)
+ sched.ngsys.Add(-1)
}
gp.m = nil
locked := gp.lockedm != 0
newg.ancestors = saveAncestors(callergp)
newg.startpc = fn.fn
if isSystemGoroutine(newg, false) {
- atomic.Xadd(&sched.ngsys, +1)
+ sched.ngsys.Add(1)
} else {
// Only user goroutines inherit pprof labels.
if mp.curg != nil {
}
func gcount() int32 {
- n := int32(atomic.Loaduintptr(&allglen)) - sched.gFree.n - int32(atomic.Load(&sched.ngsys))
+ n := int32(atomic.Loaduintptr(&allglen)) - sched.gFree.n - sched.ngsys.Load()
for _, pp := range allp {
n -= pp.gFree.n
}