[dependencies] update go-store, go-mutexes (#422)

* update go-store, go-mutexes

Signed-off-by: kim <grufwub@gmail.com>

* update vendored code

Signed-off-by: kim <grufwub@gmail.com>
This commit is contained in:
kim
2022-03-08 11:56:53 +00:00
committed by GitHub
parent 8de928b5e9
commit b8879ac68a
13 changed files with 639 additions and 268 deletions

View File

@ -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)