aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/proc.go
diff options
context:
space:
mode:
authorMichael Pratt <mpratt@google.com>2022-07-19 13:34:29 -0400
committerMichael Pratt <mpratt@google.com>2022-08-12 01:39:14 +0000
commitb464708b463b104849a951af54352c8a894bfbc4 (patch)
treebc894774b13c6e6b6379de20cfd3c3194b02c193 /src/runtime/proc.go
parentbd302502d39b6172bf3db6abfa49fdcaa124ee50 (diff)
downloadgo-b464708b463b104849a951af54352c8a894bfbc4.tar.xz
runtime: convert schedt.goidgen to atomic type
For #53821. Change-Id: I84c96ade5982b8e68d1d1787bf1bfa16a17a4fb4 Reviewed-on: https://go-review.googlesource.com/c/go/+/419439 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/runtime/proc.go')
-rw-r--r--src/runtime/proc.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/proc.go b/src/runtime/proc.go
index 33d7d6f552..d9df526f7e 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -1919,7 +1919,7 @@ func oneNewExtraM() {
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)
}
@@ -4168,7 +4168,7 @@ func newproc1(fn *funcval, callergp *g, callerpc uintptr) *g {
// 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
}