15
vendor/github.com/anacrolix/missinggo/timer.go
generated
vendored
Normal file
15
vendor/github.com/anacrolix/missinggo/timer.go
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
package missinggo
|
||||
|
||||
import (
|
||||
"math"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Returns a time.Timer that calls f. The timer is initially stopped.
|
||||
func StoppedFuncTimer(f func()) (t *time.Timer) {
|
||||
t = time.AfterFunc(math.MaxInt64, f)
|
||||
if !t.Stop() {
|
||||
panic("timer already fired")
|
||||
}
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user