Source File
timer.go
Belonging Package
github.com/cenkalti/backoff/v4
package backoffimporttype Timer interface {Start(duration time.Duration)Stop()C() <-chan time.Time}// defaultTimer implements Timer interface using time.Timertype defaultTimer struct {timer *time.Timer}// C returns the timers channel which receives the current time when the timer fires.func ( *defaultTimer) () <-chan time.Time {return .timer.C}// Start starts the timer to fire after the given durationfunc ( *defaultTimer) ( time.Duration) {if .timer == nil {.timer = time.NewTimer()} else {.timer.Reset()}}// Stop is called when the timer is not used anymore and resources may be freed.func ( *defaultTimer) () {if .timer != nil {.timer.Stop()}}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |