summaryrefslogtreecommitdiff
path: root/vendor/codeberg.org/gruf/go-mutexes/mutex_timeout.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/codeberg.org/gruf/go-mutexes/mutex_timeout.go')
-rw-r--r--vendor/codeberg.org/gruf/go-mutexes/mutex_timeout.go11
1 files changed, 3 insertions, 8 deletions
diff --git a/vendor/codeberg.org/gruf/go-mutexes/mutex_timeout.go b/vendor/codeberg.org/gruf/go-mutexes/mutex_timeout.go
index 2e7b8f802..03bf0e389 100644
--- a/vendor/codeberg.org/gruf/go-mutexes/mutex_timeout.go
+++ b/vendor/codeberg.org/gruf/go-mutexes/mutex_timeout.go
@@ -97,7 +97,9 @@ func mutexTimeout(d time.Duration, unlock func(), fn func()) func() {
// timerPool is the global &timer{} pool.
var timerPool = sync.Pool{
New: func() interface{} {
- return newtimer()
+ t := time.NewTimer(time.Minute)
+ t.Stop()
+ return &timer{t: t, c: make(chan struct{})}
},
}
@@ -107,13 +109,6 @@ type timer struct {
c chan struct{}
}
-// newtimer returns a new timer instance.
-func newtimer() *timer {
- t := time.NewTimer(time.Minute)
- t.Stop()
- return &timer{t: t, c: make(chan struct{})}
-}
-
// Start will start the timer with duration 'd', performing 'fn' on timeout.
func (t *timer) Start(d time.Duration, fn func()) {
t.t.Reset(d)