fix(list): release the sort lock on every exit (#409)

This commit is contained in:
Rupayon Haldar authored and GitHub committed 2026-10-31 09:54:39 +08:00
1 parent f7acd40303
commit 9c401c4043
2 files changed
+70

No files matched your search

+1
View File
@@ -354,6 +354,7 @@ func (c *CopyOnWriteList[T]) ForEach(f func(T)) {
func (c *CopyOnWriteList[T]) Sort(compare func(o1 T, o2 T) bool) {
lock := c.lock
lock.Lock()
defer lock.Unlock()
list := c.getList()
sort.Slice(list, func(i, j int) bool {