diff options
author | Ian Lance Taylor <iant@golang.org> | 2020-01-02 15:05:27 -0800 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2020-01-21 23:53:22 -0800 |
commit | 5a8ea165926cb0737ab03bc48c18dc5198ab5305 (patch) | |
tree | 962dc3357c57f019f85658f99e2e753e30201c27 /libgo/go/time/sleep.go | |
parent | 6ac6529e155c9baa0aaaed7aca06bd38ebda5b43 (diff) | |
download | gcc-5a8ea165926cb0737ab03bc48c18dc5198ab5305.zip gcc-5a8ea165926cb0737ab03bc48c18dc5198ab5305.tar.gz gcc-5a8ea165926cb0737ab03bc48c18dc5198ab5305.tar.bz2 |
libgo: update to Go1.14beta1
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/214297
Diffstat (limited to 'libgo/go/time/sleep.go')
-rw-r--r-- | libgo/go/time/sleep.go | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libgo/go/time/sleep.go b/libgo/go/time/sleep.go index 2cc908d..37de846 100644 --- a/libgo/go/time/sleep.go +++ b/libgo/go/time/sleep.go @@ -11,14 +11,14 @@ func Sleep(d Duration) // Interface to timers implemented in package runtime. // Must be in sync with ../runtime/time.go:/^type timer type runtimeTimer struct { - tb uintptr - i int - - when int64 - period int64 - f func(interface{}, uintptr) // NOTE: must not be closure - arg interface{} - seq uintptr + pp uintptr + when int64 + period int64 + f func(interface{}, uintptr) // NOTE: must not be closure + arg interface{} + seq uintptr + nextwhen int64 + status uint32 } // when is a helper function for setting the 'when' field of a runtimeTimer. @@ -38,6 +38,7 @@ func when(d Duration) int64 { func startTimer(*runtimeTimer) func stopTimer(*runtimeTimer) bool +func resetTimer(*runtimeTimer, int64) // The Timer type represents a single event. // When the Timer expires, the current time will be sent on C, @@ -63,7 +64,7 @@ type Timer struct { // } // // This cannot be done concurrent to other receives from the Timer's -// channel. +// channel or other calls to the Timer's Stop method. // // For a timer created with AfterFunc(d, f), if t.Stop returns false, then the timer // has already expired and the function f has been started in its own goroutine; @@ -122,8 +123,7 @@ func (t *Timer) Reset(d Duration) bool { } w := when(d) active := stopTimer(&t.r) - t.r.when = w - startTimer(&t.r) + resetTimer(&t.r, w) return active } |