MCPcopy
hub / github.com/nats-io/nats.go / Get

Method Get

timer.go:31–38  ·  view source on GitHub ↗

Get returns a timer that completes after the given duration.

(d time.Duration)

Source from the content-addressed store, hash-verified

29
30// Get returns a timer that completes after the given duration.
31func (tp *timerPool) Get(d time.Duration) *time.Timer {
32 if t, ok := tp.p.Get().(*time.Timer); ok && t != nil {
33 t.Reset(d)
34 return t
35 }
36
37 return time.NewTimer(d)
38}
39
40// Put pools the given timer.
41//

Callers 1

TestTimerPoolFunction · 0.95

Calls 2

GetMethod · 0.65
ResetMethod · 0.65

Tested by 1

TestTimerPoolFunction · 0.76