mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-28 18:42:25 -05:00
[chore] update dependencies (#4468)
- github.com/ncruces/go-sqlite3 - codeberg.org/gruf/go-mempool - codeberg.org/gruf/go-structr (changes related on the above) * - codeberg.org/gruf/go-mutexes (changes related on the above) * * this is largely just fiddling around with package internals in structr and mutexes to rely on changes in mempool, which added a new concurrency-safe pool Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4468 Co-authored-by: kim <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com>
This commit is contained in:
parent
e7cd8bb43e
commit
ff950e94bb
32 changed files with 706 additions and 317 deletions
23
vendor/codeberg.org/gruf/go-mutexes/map.go
generated
vendored
23
vendor/codeberg.org/gruf/go-mutexes/map.go
generated
vendored
|
|
@ -26,14 +26,13 @@ const (
|
|||
type MutexMap struct {
|
||||
mapmu sync.Mutex
|
||||
mumap hashmap
|
||||
mupool mempool.UnsafePool
|
||||
mupool mempool.UnsafeSimplePool
|
||||
}
|
||||
|
||||
// checkInit ensures MutexMap is initialized (UNSAFE).
|
||||
func (mm *MutexMap) checkInit() {
|
||||
if mm.mumap.m == nil {
|
||||
mm.mumap.init(0)
|
||||
mm.mupool.DirtyFactor = 256
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -175,13 +174,9 @@ func (mu *rwmutex) Lock(lt uint8) bool {
|
|||
// sleeping goroutines waiting on this mutex.
|
||||
func (mu *rwmutex) Unlock() bool {
|
||||
switch mu.l--; {
|
||||
case mu.l > 0 && mu.t == lockTypeWrite:
|
||||
panic("BUG: multiple writer locks")
|
||||
case mu.l < 0:
|
||||
panic("BUG: negative lock count")
|
||||
|
||||
case mu.l == 0:
|
||||
// Fully unlocked.
|
||||
// Fully
|
||||
// unlock.
|
||||
mu.t = 0
|
||||
|
||||
// Awake all blocked goroutines and check
|
||||
|
|
@ -197,11 +192,15 @@ func (mu *rwmutex) Unlock() bool {
|
|||
// (before == after) => (waiters = 0)
|
||||
return (before == after)
|
||||
|
||||
default:
|
||||
// i.e. mutex still
|
||||
// locked by others.
|
||||
return false
|
||||
case mu.l < 0:
|
||||
panic("BUG: negative lock count")
|
||||
case mu.t == lockTypeWrite:
|
||||
panic("BUG: multiple write locks")
|
||||
}
|
||||
|
||||
// i.e. mutex still
|
||||
// locked by others.
|
||||
return false
|
||||
}
|
||||
|
||||
// WaitRelock expects a mutex to be passed in, already in the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue