diff options
author | Ian Lance Taylor <iant@golang.org> | 2020-01-10 10:10:32 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2020-01-10 19:19:22 +0000 |
commit | e6bbe967edef58073918ffd197e44d1559c90737 (patch) | |
tree | 03e5f112a98836767e877d4eba199e2dad1dbf51 /src/runtime/time.go | |
parent | 8b774103d3f833775e7e214bf51a37b3cfa39615 (diff) | |
download | go-e6bbe967edef58073918ffd197e44d1559c90737.tar.gz go-e6bbe967edef58073918ffd197e44d1559c90737.zip |
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 <iant@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/time.go')
-rw-r--r-- | src/runtime/time.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/runtime/time.go b/src/runtime/time.go index d64bea814f..e0dfd6a5cd 100644 --- a/src/runtime/time.go +++ b/src/runtime/time.go @@ -669,6 +669,8 @@ func adjusttimers(pp *p) { return } } + // Look at this heap position again. + i-- } case timerNoStatus, timerRunning, timerRemoving, timerRemoved, timerMoving: badTimer() |