aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/time/sleep.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/time/sleep.go')
-rw-r--r--libgo/go/time/sleep.go16
1 files changed, 6 insertions, 10 deletions
diff --git a/libgo/go/time/sleep.go b/libgo/go/time/sleep.go
index 4f45799..1ffaabe 100644
--- a/libgo/go/time/sleep.go
+++ b/libgo/go/time/sleep.go
@@ -14,8 +14,8 @@ type runtimeTimer struct {
pp uintptr
when int64
period int64
- f func(interface{}, uintptr) // NOTE: must not be closure
- arg interface{}
+ f func(any, uintptr) // NOTE: must not be closure
+ arg any
seq uintptr
nextwhen int64
status uint32
@@ -41,7 +41,7 @@ func when(d Duration) int64 {
func startTimer(*runtimeTimer)
func stopTimer(*runtimeTimer) bool
func resetTimer(*runtimeTimer, int64) bool
-func modTimer(t *runtimeTimer, when, period int64, f func(interface{}, uintptr), arg interface{}, seq uintptr)
+func modTimer(t *runtimeTimer, when, period int64, f func(any, uintptr), arg any, seq uintptr)
// The Timer type represents a single event.
// When the Timer expires, the current time will be sent on C,
@@ -139,12 +139,8 @@ func (t *Timer) Reset(d Duration) bool {
return resetTimer(&t.r, w)
}
-func sendTime(c interface{}, seq uintptr) {
- // Non-blocking send of time on c.
- // Used in NewTimer, it cannot block anyway (buffer).
- // Used in NewTicker, dropping sends on the floor is
- // the desired behavior when the reader gets behind,
- // because the sends are periodic.
+// sendTime does a non-blocking send of the current time on c.
+func sendTime(c any, seq uintptr) {
select {
case c.(chan Time) <- Now():
default:
@@ -176,6 +172,6 @@ func AfterFunc(d Duration, f func()) *Timer {
return t
}
-func goFunc(arg interface{}, seq uintptr) {
+func goFunc(arg any, seq uintptr) {
go arg.(func())()
}