Skip to content

Commit e6bbe96

Browse files
runtime: don't skip timer when adjustTimers sees a modified timer
When adjustTimers sees a timerModifiedEarlier or timerModifiedLater, it removes it from the heap, leaving a new timer at that position in the heap. We were accidentally skipping that new timer in our loop. In some unlikely cases this could cause adjustTimers to look at more timers than necessary. Change-Id: Ic71e54c175ab7d86a7fa46f1497aca71ed1c43cc Reviewed-on: https://go-review.googlesource.com/c/go/+/214338 Run-TryBot: Ian Lance Taylor <[email protected]> Reviewed-by: Michael Knyszek <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 8b77410 commit e6bbe96

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/runtime/time.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,8 @@ func adjusttimers(pp *p) {
669669
return
670670
}
671671
}
672+
// Look at this heap position again.
673+
i--
672674
}
673675
case timerNoStatus, timerRunning, timerRemoving, timerRemoved, timerMoving:
674676
badTimer()

0 commit comments

Comments
 (0)