func (tb *timersBucket) addtimerLocked(t *timer) bool {
	// when must never be negative; otherwise timerproc will overflow
	// during its delta calculation and never expire other runtime timers.
	if t.when < 0 {
		t.when = 1<<63 - 1
	}
	t.i = len(tb.t)
	tb.t = append(tb.t, t)
	if !siftupTimer(tb.t, t.i) {
		return false
	}
	if t.i == 0 {
		// siftup moved to top: new earliest deadline.
		if tb.sleeping && tb.sleepUntil > t.when {
			tb.sleeping = false
			notewakeup(&tb.waitnote)
		}
		if tb.rescheduling {
			tb.rescheduling = false
			goready(tb.gp, 0)
		}
		if !tb.created {
			tb.created = true
			expectSystemGoroutine()
			go timerproc(tb)
		}
	}
	return true
}
// Add a timer to the heap and start or kick timerproc if the new timer is
// earlier than any of the others.
// Timers are locked.
// Returns whether all is well: false if the data structure is corrupt
// due to user-level races.
Add a timer to the heap and start or kick timerproc if the new timer is
earlier than any of the others.
Timers are locked.
Returns whether all is well: false if the data structure is corrupt
due to user-level races.
// Add a timer to the heap and start or kick timerproc if the new timer is // earlier than any of the others . // Timers are locked . // Returns whether all is well : false if the data structure is corrupt // due to user - level races .
func (tb *timersBucket) addtimerLocked(t *timer) bool {
	if t.when < 0 {
		t.when = 1<<63 - 1
	}
	t.i = len(tb.t)
	tb.t = append(tb.t, t)
	if !siftupTimer(tb.t, t.i) {
		return false
	}
	if t.i == 0 {
		if tb.sleeping && tb.sleepUntil > t.when {
			tb.sleeping = false
			notewakeup(&tb.waitnote)
		}
		if tb.rescheduling {
			tb.rescheduling = false
			goready(tb.gp, 0)
		}
		if !tb.created {
			tb.created = true
			expectSystemGoroutine()
			go timerproc(tb)
		}
	}
	return true
}
func ( tb * timersBucket ) addtimerLocked ( t * timer ) bool { if t . when < 0 { t . when = 1 << 63 - 1 } t . i = len ( tb . t ) tb . t = append ( tb . t , t ) if ! siftupTimer ( tb . t , t . i ) { return false } if t . i == 0 { if tb . sleeping && tb . sleepUntil > t . when { tb . sleeping = false notewakeup ( & tb . waitnote ) } if tb . rescheduling { tb . rescheduling = false goready ( tb . gp , 0 ) } if ! tb . created { tb . created = true expectSystemGoroutine ( ) go timerproc ( tb ) } } return true }
Add a timer to the heap and start or kick timerproc if the new timer is
earlier than any of the others.
Add a timer to the heap and start or kick timerproc if the new timer is earlier than any of the others .
// when must never be negative; otherwise timerproc will overflow // during its delta calculation and never expire other runtime timers. // siftup moved to top: new earliest deadline.