MCPcopy Index your code
hub / github.com/desertbit/timer / NewStoppedTimer

Function NewStoppedTimer

timer.go:35–55  ·  view source on GitHub ↗

NewStoppedTimer creates a new stopped Timer.

()

Source from the content-addressed store, hash-verified

33
34// NewStoppedTimer creates a new stopped Timer.
35func NewStoppedTimer() *Timer {
36 c := make(chan time.Time, 1)
37 t := &Timer{
38 C: c,
39 f: func(t *time.Time) {
40 // Don't block.
41 select {
42 case c <- *t:
43 default:
44 }
45 },
46 reset: func() {
47 // Empty the channel if filled.
48 select {
49 case <-c:
50 default:
51 }
52 },
53 }
54 return t
55}
56
57// Stop prevents the Timer from firing.
58// It returns true if the call stops the timer,

Callers 2

TestStoppedTimerFunction · 0.85
NewTimerFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestStoppedTimerFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…