aboutsummaryrefslogtreecommitdiff
path: root/src/time
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2020-04-03 12:52:17 -0700
committerIan Lance Taylor <iant@golang.org>2020-04-06 03:35:33 +0000
commit5f3354d1bf2e6a61e4b9e1e31ee04b99dfe7de35 (patch)
tree5f6516429d7639976bed14bdbc4b68ab0586cdc5 /src/time
parent763bd58b19a3aea9760cb8c8326dabf78653db68 (diff)
downloadgo-5f3354d1bf2e6a61e4b9e1e31ee04b99dfe7de35.tar.gz
go-5f3354d1bf2e6a61e4b9e1e31ee04b99dfe7de35.zip
time, runtime: only call resetTimer from (*Timer).Reset
Previously we stopped the timer and then reset it. With the current timer implementation that is no longer required. Change-Id: Ie7aba61ad53ce835f6fcd0b6bce7fe0a15b10e24 Reviewed-on: https://go-review.googlesource.com/c/go/+/227180 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/time')
-rw-r--r--src/time/sleep.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/time/sleep.go b/src/time/sleep.go
index bd0ed9aaba..22ffd68282 100644
--- a/src/time/sleep.go
+++ b/src/time/sleep.go
@@ -38,7 +38,7 @@ func when(d Duration) int64 {
func startTimer(*runtimeTimer)
func stopTimer(*runtimeTimer) bool
-func resetTimer(*runtimeTimer, int64)
+func resetTimer(*runtimeTimer, int64) bool
func modTimer(t *runtimeTimer, when, period int64, f func(interface{}, uintptr), arg interface{}, seq uintptr)
// The Timer type represents a single event.
@@ -123,9 +123,7 @@ func (t *Timer) Reset(d Duration) bool {
panic("time: Reset called on uninitialized Timer")
}
w := when(d)
- active := stopTimer(&t.r)
- resetTimer(&t.r, w)
- return active
+ return resetTimer(&t.r, w)
}
func sendTime(c interface{}, seq uintptr) {