// so it emits the test and keeps the call, giving the desired
// escape analysis result. The test is cheaper than the call.
var cgoAlwaysFalse bool
+
+var cgo_yield = &_cgo_yield
throw("notesleep not on g0")
}
ns := int64(-1)
- if _cgo_yield != nil {
+ if *cgo_yield != nil {
// Sleep for an arbitrary-but-moderate interval to poll libc interceptors.
ns = 10e6
}
for atomic.Load(key32(&n.key)) == 0 {
gp.m.blocked = true
futexsleep(key32(&n.key), 0, ns)
- if _cgo_yield != nil {
- asmcgocall(_cgo_yield, nil)
+ if *cgo_yield != nil {
+ asmcgocall(*cgo_yield, nil)
}
gp.m.blocked = false
}
gp := getg()
if ns < 0 {
- if _cgo_yield != nil {
+ if *cgo_yield != nil {
// Sleep for an arbitrary-but-moderate interval to poll libc interceptors.
ns = 10e6
}
for atomic.Load(key32(&n.key)) == 0 {
gp.m.blocked = true
futexsleep(key32(&n.key), 0, ns)
- if _cgo_yield != nil {
- asmcgocall(_cgo_yield, nil)
+ if *cgo_yield != nil {
+ asmcgocall(*cgo_yield, nil)
}
gp.m.blocked = false
}
deadline := nanotime() + ns
for {
- if _cgo_yield != nil && ns > 10e6 {
+ if *cgo_yield != nil && ns > 10e6 {
ns = 10e6
}
gp.m.blocked = true
futexsleep(key32(&n.key), 0, ns)
- if _cgo_yield != nil {
- asmcgocall(_cgo_yield, nil)
+ if *cgo_yield != nil {
+ asmcgocall(*cgo_yield, nil)
}
gp.m.blocked = false
if atomic.Load(key32(&n.key)) != 0 {
}
// Queued. Sleep.
gp.m.blocked = true
- if _cgo_yield == nil {
+ if *cgo_yield == nil {
semasleep(-1)
} else {
// Sleep for an arbitrary-but-moderate interval to poll libc interceptors.
const ns = 10e6
for atomic.Loaduintptr(&n.key) == 0 {
semasleep(ns)
- asmcgocall(_cgo_yield, nil)
+ asmcgocall(*cgo_yield, nil)
}
}
gp.m.blocked = false
if ns < 0 {
// Queued. Sleep.
gp.m.blocked = true
- if _cgo_yield == nil {
+ if *cgo_yield == nil {
semasleep(-1)
} else {
// Sleep in arbitrary-but-moderate intervals to poll libc interceptors.
const ns = 10e6
for semasleep(ns) < 0 {
- asmcgocall(_cgo_yield, nil)
+ asmcgocall(*cgo_yield, nil)
}
}
gp.m.blocked = false
for {
// Registered. Sleep.
gp.m.blocked = true
- if _cgo_yield != nil && ns > 10e6 {
+ if *cgo_yield != nil && ns > 10e6 {
ns = 10e6
}
if semasleep(ns) >= 0 {
// Done.
return true
}
- if _cgo_yield != nil {
- asmcgocall(_cgo_yield, nil)
+ if *cgo_yield != nil {
+ asmcgocall(*cgo_yield, nil)
}
gp.m.blocked = false
// Interrupted or timed out. Still registered. Semaphore not acquired.
ready(gp, 0, true)
}
}
- if _cgo_yield != nil {
- asmcgocall(_cgo_yield, nil)
+ if *cgo_yield != nil {
+ asmcgocall(*cgo_yield, nil)
}
// local runq
unlock(&sched.lock)
}
// trigger libc interceptors if needed
- if _cgo_yield != nil {
- asmcgocall(_cgo_yield, nil)
+ if *cgo_yield != nil {
+ asmcgocall(*cgo_yield, nil)
}
// poll network if not polled for more than 10ms
lastpoll := int64(atomic.Load64(&sched.lastpoll))