summaryrefslogtreecommitdiff
path: root/vendor/codeberg.org/gruf/go-mutexes/mutex.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2022-03-08 11:56:53 +0000
committerLibravatar GitHub <noreply@github.com>2022-03-08 12:56:53 +0100
commitb8879ac68a30e8bccd1c96cc4630da791d8996c4 (patch)
tree77adeeaf2456610b771d9df8dc38207014215aea /vendor/codeberg.org/gruf/go-mutexes/mutex.go
parent[performance] Database optimizations (#419) (diff)
downloadgotosocial-b8879ac68a30e8bccd1c96cc4630da791d8996c4.tar.xz
[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>
Diffstat (limited to 'vendor/codeberg.org/gruf/go-mutexes/mutex.go')
-rw-r--r--vendor/codeberg.org/gruf/go-mutexes/mutex.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/vendor/codeberg.org/gruf/go-mutexes/mutex.go b/vendor/codeberg.org/gruf/go-mutexes/mutex.go
index c4f3f8876..3841c9423 100644
--- a/vendor/codeberg.org/gruf/go-mutexes/mutex.go
+++ b/vendor/codeberg.org/gruf/go-mutexes/mutex.go
@@ -41,24 +41,24 @@ func WithFuncRW(mu RWMutex, onLock, onRLock, onUnlock, onRUnlock func()) RWMutex
}
// baseMutex simply wraps a sync.Mutex to implement our Mutex interface
-type baseMutex struct{ mu sync.Mutex }
+type baseMutex sync.Mutex
func (mu *baseMutex) Lock() func() {
- mu.mu.Lock()
- return mu.mu.Unlock
+ (*sync.Mutex)(mu).Lock()
+ return (*sync.Mutex)(mu).Unlock
}
// baseRWMutex simply wraps a sync.RWMutex to implement our RWMutex interface
-type baseRWMutex struct{ mu sync.RWMutex }
+type baseRWMutex sync.RWMutex
func (mu *baseRWMutex) Lock() func() {
- mu.mu.Lock()
- return mu.mu.Unlock
+ (*sync.RWMutex)(mu).Lock()
+ return (*sync.RWMutex)(mu).Unlock
}
func (mu *baseRWMutex) RLock() func() {
- mu.mu.RLock()
- return mu.mu.RUnlock
+ (*sync.RWMutex)(mu).RLock()
+ return (*sync.RWMutex)(mu).RUnlock
}
// fnMutex wraps a Mutex to add hooks for Lock and Unlock