Home | History | Annotate | Download | only in time

Lines Matching refs:Timer

15 // Must be in sync with ../runtime/time.go:/^type timer
43 // The Timer type represents a single event.
44 // When the Timer expires, the current time will be sent on C,
45 // unless the Timer was created by AfterFunc.
46 // A Timer must be created with NewTimer or AfterFunc.
47 type Timer struct {
52 // Stop prevents the Timer from firing.
53 // It returns true if the call stops the timer, false if the timer has already
58 // To prevent a timer created with NewTimer from firing after a call to Stop,
66 // This cannot be done concurrent to other receives from the Timer's
69 // For a timer created with AfterFunc(d, f), if t.Stop returns false, then the timer
74 func (t *Timer) Stop() bool {
76 panic("time: Stop called on uninitialized Timer")
81 // NewTimer creates a new Timer that will send
83 func NewTimer(d Duration) *Timer {
85 t := &Timer{
97 // Reset changes the timer to expire after duration d.
98 // It returns true if the timer had been active, false if the timer had
101 // Resetting a timer must take care not to race with the send into t.C
102 // that happens when the current timer expires.
103 // If a program has already received a value from t.C, the timer is known
106 // the timer must be stopped and?if Stop reports that the timer expired
114 // This should not be done concurrent to other receives from the Timer's
118 // is a race condition between draining the channel and the new timer expiring.
121 func (t *Timer) Reset(d Duration) bool {
123 panic("time: Reset called on uninitialized Timer")
147 // The underlying Timer is not recovered by the garbage collector
148 // until the timer fires. If efficiency is a concern, use NewTimer
149 // instead and call Timer.Stop if the timer is no longer needed.
155 // in its own goroutine. It returns a Timer that can
157 func AfterFunc(d Duration, f func()) *Timer {
158 t := &Timer{