From b8879ac68a30e8bccd1c96cc4630da791d8996c4 Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Tue, 8 Mar 2022 11:56:53 +0000 Subject: [dependencies] update go-store, go-mutexes (#422) * update go-store, go-mutexes Signed-off-by: kim * update vendored code Signed-off-by: kim --- vendor/codeberg.org/gruf/go-mutexes/mutex_timeout.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'vendor/codeberg.org/gruf/go-mutexes/mutex_timeout.go') 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) -- cgit v1.2.3