summaryrefslogtreecommitdiff
path: root/vendor/codeberg.org/gruf/go-structr/timeline.go
diff options
context:
space:
mode:
authorLibravatar kim <grufwub@gmail.com>2025-10-03 15:29:41 +0200
committerLibravatar kim <gruf@noreply.codeberg.org>2025-10-03 15:29:41 +0200
commitff950e94bb8a2e1b3c905bdba4c44d0232704b18 (patch)
treea6aedfd6a89438f400bc20c90457552e4176f1ba /vendor/codeberg.org/gruf/go-structr/timeline.go
parent[chore] Use bulk updates + fewer loops in status rethreading migration (#4459) (diff)
downloadgotosocial-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/timeline.go')
-rw-r--r--vendor/codeberg.org/gruf/go-structr/timeline.go19
1 files changed, 10 insertions, 9 deletions
diff --git a/vendor/codeberg.org/gruf/go-structr/timeline.go b/vendor/codeberg.org/gruf/go-structr/timeline.go
index 1e9703fca..749ec862a 100644
--- a/vendor/codeberg.org/gruf/go-structr/timeline.go
+++ b/vendor/codeberg.org/gruf/go-structr/timeline.go
@@ -8,6 +8,8 @@ import (
"strings"
"sync"
"unsafe"
+
+ "codeberg.org/gruf/go-mempool"
)
// Direction defines a direction
@@ -1133,18 +1135,16 @@ func to_timeline_item(item *indexed_item) *timeline_item {
return to
}
-var timeline_item_pool sync.Pool
+var timeline_item_pool mempool.UnsafePool
// new_timeline_item returns a new prepared timeline_item.
func new_timeline_item() *timeline_item {
- v := timeline_item_pool.Get()
- if v == nil {
- i := new(timeline_item)
- i.elem.data = unsafe.Pointer(i)
- i.ck = ^uint(0)
- v = i
+ if ptr := timeline_item_pool.Get(); ptr != nil {
+ return (*timeline_item)(ptr)
}
- item := v.(*timeline_item)
+ item := new(timeline_item)
+ item.elem.data = unsafe.Pointer(item)
+ item.ck = ^uint(0)
return item
}
@@ -1159,5 +1159,6 @@ func free_timeline_item(item *timeline_item) {
}
item.data = nil
item.pk = nil
- timeline_item_pool.Put(item)
+ ptr := unsafe.Pointer(item)
+ timeline_item_pool.Put(ptr)
}