diff options
| author | Changkun Ou <hi@changkun.us> | 2020-02-03 14:42:32 +0100 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2020-02-24 01:50:28 +0000 |
| commit | 402ea9e4f9ddcd2ed595ac12ce1b4e39f82e128f (patch) | |
| tree | 7013229276d72fc24079c310be3a20c6bde100e9 /src/time/sleep.go | |
| parent | 0f2a1574b02de3fec6937e65b1bdc21106bef15c (diff) | |
| download | go-402ea9e4f9ddcd2ed595ac12ce1b4e39f82e128f.tar.xz | |
time: add Ticker.Reset
This CL implements Ticker.Reset method in time package.
Benchmark:
name time/op
TickerReset-12 6.41µs ±10%
TickerResetNaive-12 95.7µs ±12%
Fixes #33184
Change-Id: I4cbd31796efa012b2a297bb342158f11a4a31fef
Reviewed-on: https://go-review.googlesource.com/c/go/+/220424
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/time/sleep.go')
| -rw-r--r-- | src/time/sleep.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/time/sleep.go b/src/time/sleep.go index 37de846b11..bd0ed9aaba 100644 --- a/src/time/sleep.go +++ b/src/time/sleep.go @@ -39,6 +39,7 @@ func when(d Duration) int64 { func startTimer(*runtimeTimer) func stopTimer(*runtimeTimer) bool func resetTimer(*runtimeTimer, int64) +func modTimer(t *runtimeTimer, when, period int64, f func(interface{}, uintptr), arg interface{}, seq uintptr) // The Timer type represents a single event. // When the Timer expires, the current time will be sent on C, |
