// the goroutine until we're done.
if castogscanstatus(gp, s, s|_Gscan) {
if !gp.gcscandone {
+ // Coordinate with traceback
+ // in sigprof.
+ for !cas(&gp.stackLock, 0, 1) {
+ osyield()
+ }
scanstack(gp)
+ atomicstore(&gp.stackLock, 0)
gp.gcscandone = true
}
restartg(gp)
// Profiling runs concurrently with GC, so it must not allocate.
mp.mallocing++
+ // Coordinate with stack barrier insertion in scanstack.
+ for !cas(&gp.stackLock, 0, 1) {
+ osyield()
+ }
+
// Define that a "user g" is a user-created goroutine, and a "system g"
// is one that is m->g0 or m->gsignal.
//
}
}
}
+ atomicstore(&gp.stackLock, 0)
if prof.hz != 0 {
// Simple cas-lock to coordinate with setcpuprofilerate.
stkbarPos uintptr // index of lowest stack barrier not hit
param unsafe.Pointer // passed parameter on wakeup
atomicstatus uint32
+ stackLock uint32 // sigprof/scang lock; TODO: fold in to atomicstatus
goid int64
waitsince int64 // approx time when the g become blocked
waitreason string // if status==Gwaiting