File: sleep.go

package info (click to toggle)
golang-github-siddontang-go 0.0~git20170517.0.cb568a3-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 492 kB
  • sloc: makefile: 3
file content (34 lines) | stat: -rw-r--r-- 512 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package time2

import (
	"time"
)

type Timer struct {
	C <-chan time.Time
	r *timer
}

func After(d time.Duration) <-chan time.Time {
	return defaultWheel.After(d)
}

func Sleep(d time.Duration) {
	defaultWheel.Sleep(d)
}

func AfterFunc(d time.Duration, f func()) *Timer {
	return defaultWheel.AfterFunc(d, f)
}

func NewTimer(d time.Duration) *Timer {
	return defaultWheel.NewTimer(d)
}

func (t *Timer) Reset(d time.Duration) {
	t.r.w.resetTimer(t.r, d, 0)
}

func (t *Timer) Stop() {
	t.r.w.delTimer(t.r)
}