I noticed that the source code mentions in many places that timers depend 
on netpoll. However, I understand that timers are triggered via 
pp.timers.check() within findRunnable(). How exactly do timers rely on 
netpoll then? Am I missing something here?



func (ts *timers) addHeap(t *timer) {
assertWorldStoppedOrLockHeld(&ts.mu)
// *Timers rely on the network poller*, so make sure the poller
// has started.
if netpollInited.Load() == 0 {
netpollGenericInit()
}

if GOOS == "netbsd" && needSysmonWorkaround {
// *netpoll is responsible for waiting for timer*
// expiration, so we typically don't have to worry
// about starting an M to service timers. (Note that
// sleep for timeSleepUntil above simply ensures sysmon
// starts running again when that timer expiration may
// cause Go code to run again).
//
// However, netbsd has a kernel bug that sometimes
// misses netpollBreak wake-ups, which can lead to
// unbounded delays servicing timers. If we detect this
// overrun, then startm to get something to handle the
// timer.
//
// See issue 42515 and
// https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=50094.
if next := timeSleepUntil(); next < now {
startm(nil, false, false)
}
}


-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/cea48311-a590-4751-9853-e73695558443n%40googlegroups.com.

Reply via email to