unsafe.Offsetof(p{}.timer0When),
unsafe.Offsetof(p{}.timerModifiedEarliest),
unsafe.Offsetof(p{}.gcFractionalMarkTime),
- unsafe.Offsetof(schedt{}.goidgen),
unsafe.Offsetof(schedt{}.lastpoll),
unsafe.Offsetof(schedt{}.pollUntil),
unsafe.Offsetof(schedt{}.timeToRun),
mp.lockedInt++
mp.lockedg.set(gp)
gp.lockedm.set(mp)
- gp.goid = int64(atomic.Xadd64(&sched.goidgen, 1))
+ gp.goid = int64(sched.goidgen.Add(1))
if raceenabled {
gp.racectx = racegostart(abi.FuncPCABIInternal(newextram) + sys.PCQuantum)
}
// Sched.goidgen is the last allocated id,
// this batch must be [sched.goidgen+1, sched.goidgen+GoidCacheBatch].
// At startup sched.goidgen=0, so main goroutine receives goid=1.
- pp.goidcache = atomic.Xadd64(&sched.goidgen, _GoidCacheBatch)
+ pp.goidcache = sched.goidgen.Add(_GoidCacheBatch)
pp.goidcache -= _GoidCacheBatch - 1
pp.goidcacheend = pp.goidcache + _GoidCacheBatch
}
type schedt struct {
// accessed atomically. keep at top to ensure alignment on 32-bit systems.
- goidgen uint64
+ goidgen atomic.Uint64
lastpoll uint64 // time of last network poll, 0 if currently polling
pollUntil uint64 // time to which current poll is sleeping