diff options
| author | 2025-10-03 15:29:41 +0200 | |
|---|---|---|
| committer | 2025-10-03 15:29:41 +0200 | |
| commit | ff950e94bb8a2e1b3c905bdba4c44d0232704b18 (patch) | |
| tree | a6aedfd6a89438f400bc20c90457552e4176f1ba /vendor/codeberg.org/gruf/go-structr/index.go | |
| parent | [chore] Use bulk updates + fewer loops in status rethreading migration (#4459) (diff) | |
| download | gotosocial-ff950e94bb8a2e1b3c905bdba4c44d0232704b18.tar.xz | |
[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>
Diffstat (limited to 'vendor/codeberg.org/gruf/go-structr/index.go')
| -rw-r--r-- | vendor/codeberg.org/gruf/go-structr/index.go | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/vendor/codeberg.org/gruf/go-structr/index.go b/vendor/codeberg.org/gruf/go-structr/index.go index d5bd5562e..d8469577d 100644 --- a/vendor/codeberg.org/gruf/go-structr/index.go +++ b/vendor/codeberg.org/gruf/go-structr/index.go @@ -4,10 +4,10 @@ import ( "os" "reflect" "strings" - "sync" "unsafe" "codeberg.org/gruf/go-byteutil" + "codeberg.org/gruf/go-mempool" "codeberg.org/gruf/go-xunsafe" ) @@ -371,17 +371,15 @@ type index_entry struct { key string } -var index_entry_pool sync.Pool +var index_entry_pool mempool.UnsafePool // new_index_entry returns a new prepared index_entry. func new_index_entry() *index_entry { - v := index_entry_pool.Get() - if v == nil { - e := new(index_entry) - e.elem.data = unsafe.Pointer(e) - v = e + if ptr := index_entry_pool.Get(); ptr != nil { + return (*index_entry)(ptr) } - entry := v.(*index_entry) + entry := new(index_entry) + entry.elem.data = unsafe.Pointer(entry) return entry } @@ -396,7 +394,8 @@ func free_index_entry(entry *index_entry) { entry.key = "" entry.index = nil entry.item = nil - index_entry_pool.Put(entry) + ptr := unsafe.Pointer(entry) + index_entry_pool.Put(ptr) } func is_unique(f uint8) bool { |
