diff options
author | Wim <wim@42.be> | 2023-08-05 20:43:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-05 20:43:19 +0200 |
commit | 56e7bd01ca09ad52b0c4f48f146a20a4f1b78696 (patch) | |
tree | b1355645342667209263cbd355dc0b4254f1e8fe /vendor/modernc.org/sqlite/lib/mutex.go | |
parent | 9459495484d6e06a3d46de64fccd8d06f7ccc72c (diff) | |
download | matterbridge-msglm-56e7bd01ca09ad52b0c4f48f146a20a4f1b78696.tar.gz matterbridge-msglm-56e7bd01ca09ad52b0c4f48f146a20a4f1b78696.tar.bz2 matterbridge-msglm-56e7bd01ca09ad52b0c4f48f146a20a4f1b78696.zip |
Diffstat (limited to 'vendor/modernc.org/sqlite/lib/mutex.go')
-rw-r--r-- | vendor/modernc.org/sqlite/lib/mutex.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/vendor/modernc.org/sqlite/lib/mutex.go b/vendor/modernc.org/sqlite/lib/mutex.go index be44263a..4dd679a3 100644 --- a/vendor/modernc.org/sqlite/lib/mutex.go +++ b/vendor/modernc.org/sqlite/lib/mutex.go @@ -92,13 +92,17 @@ func mutexFromPtr(p uintptr) *mutex { if p == 0 { return nil } + ix := p - 1 + + mutexes.Lock() + defer mutexes.Unlock() + return &mutexes.a[ix>>8][ix&255] } func (m *mutexPool) alloc(recursive bool) uintptr { m.Lock() - defer m.Unlock() n := len(m.freeList) @@ -124,8 +128,8 @@ func (m *mutexPool) free(p uintptr) { ptr := mutexFromPtr(p) ix := ptr.poolIndex *ptr = mutex{} - m.Lock() + m.Lock() defer m.Unlock() m.freeList = append(m.freeList, ix) |