Get returns a timer that completes after the given duration.
(d time.Duration)
| 29 | |
| 30 | // Get returns a timer that completes after the given duration. |
| 31 | func (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 | // |