diff options
author | 2021-09-13 09:33:01 +0100 | |
---|---|---|
committer | 2021-09-13 10:33:01 +0200 | |
commit | 635281f1339e2cbe0be4e801545d126090d57f6d (patch) | |
tree | c9abe9d733724f0c0a80ab07f9b713155633ec82 /vendor/git.iim.gay/grufwub/go-mutexes/mutex_timeout.go | |
parent | Merge pull request #214 from NyaaaWhatsUpDoc/improvement/update-storage-library (diff) | |
download | gotosocial-635281f1339e2cbe0be4e801545d126090d57f6d.tar.xz |
update my personal library versions (#220)
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
Diffstat (limited to 'vendor/git.iim.gay/grufwub/go-mutexes/mutex_timeout.go')
-rw-r--r-- | vendor/git.iim.gay/grufwub/go-mutexes/mutex_timeout.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/vendor/git.iim.gay/grufwub/go-mutexes/mutex_timeout.go b/vendor/git.iim.gay/grufwub/go-mutexes/mutex_timeout.go index ffda6e890..65ca9f39e 100644 --- a/vendor/git.iim.gay/grufwub/go-mutexes/mutex_timeout.go +++ b/vendor/git.iim.gay/grufwub/go-mutexes/mutex_timeout.go @@ -43,7 +43,7 @@ type timeoutMutex struct { } func (mu *timeoutMutex) Lock() func() { - return mu.LockFunc(func() { panic("timed out") }) + return mu.LockFunc(func() { panic("lock timed out") }) } func (mu *timeoutMutex) LockFunc(fn func()) func() { @@ -58,7 +58,7 @@ type timeoutRWMutex struct { } func (mu *timeoutRWMutex) Lock() func() { - return mu.LockFunc(func() { panic("timed out") }) + return mu.LockFunc(func() { panic("lock timed out") }) } func (mu *timeoutRWMutex) LockFunc(fn func()) func() { @@ -66,7 +66,7 @@ func (mu *timeoutRWMutex) LockFunc(fn func()) func() { } func (mu *timeoutRWMutex) RLock() func() { - return mu.RLockFunc(func() { panic("timed out") }) + return mu.RLockFunc(func() { panic("rlock timed out") }) } func (mu *timeoutRWMutex) RLockFunc(fn func()) func() { @@ -76,7 +76,8 @@ func (mu *timeoutRWMutex) RLockFunc(fn func()) func() { // timeoutPool provides nowish.Timeout objects for timeout mutexes var timeoutPool = sync.Pool{ New: func() interface{} { - return nowish.NewTimeout() + t := nowish.NewTimeout() + return &t }, } @@ -88,7 +89,7 @@ func mutexTimeout(d time.Duration, unlock func(), fn func()) func() { } // Acquire timeout obj - t := timeoutPool.Get().(nowish.Timeout) + t := timeoutPool.Get().(*nowish.Timeout) // Start the timeout with hook t.Start(d, fn) |