diff --git a/node_16.go b/node_16.go index 4201599..7c68e0f 100644 --- a/node_16.go +++ b/node_16.go @@ -232,7 +232,7 @@ func (n *Node16[T]) LowerBoundIterator() *LowerBoundIterator[T] { } func (n *Node16[T]) incrementLazyRefCount(inc int64) { - n.lazyRefCount += inc + atomic.AddInt64(&n.lazyRefCount, inc) } func (n *Node16[T]) processRefCount() { @@ -248,7 +248,7 @@ func (n *Node16[T]) processRefCount() { child.incrementLazyRefCount(n.lazyRefCount) } } - n.lazyRefCount = 0 + atomic.StoreInt64(&n.lazyRefCount, 0) } func (n *Node16[T]) getRefCount() int64 { diff --git a/node_256.go b/node_256.go index 08401be..6f14b9b 100644 --- a/node_256.go +++ b/node_256.go @@ -229,7 +229,7 @@ func (n *Node256[T]) LowerBoundIterator() *LowerBoundIterator[T] { } func (n *Node256[T]) incrementLazyRefCount(inc int64) { - n.lazyRefCount += inc + atomic.AddInt64(&n.lazyRefCount, inc) } func (n *Node256[T]) processRefCount() { @@ -245,7 +245,7 @@ func (n *Node256[T]) processRefCount() { child.incrementLazyRefCount(n.lazyRefCount) } } - n.lazyRefCount = 0 + atomic.StoreInt64(&n.lazyRefCount, 0) } func (n *Node256[T]) getRefCount() int64 { diff --git a/node_4.go b/node_4.go index a916c6f..6aa380f 100644 --- a/node_4.go +++ b/node_4.go @@ -232,7 +232,7 @@ func (n *Node4[T]) LowerBoundIterator() *LowerBoundIterator[T] { } func (n *Node4[T]) incrementLazyRefCount(inc int64) { - n.lazyRefCount += inc + atomic.AddInt64(&n.lazyRefCount, inc) } func (n *Node4[T]) processRefCount() { @@ -248,7 +248,7 @@ func (n *Node4[T]) processRefCount() { child.incrementLazyRefCount(n.lazyRefCount) } } - n.lazyRefCount = 0 + atomic.StoreInt64(&n.lazyRefCount, 0) } func (n *Node4[T]) getRefCount() int64 { diff --git a/node_48.go b/node_48.go index 7daeaba..17745f9 100644 --- a/node_48.go +++ b/node_48.go @@ -237,7 +237,7 @@ func (n *Node48[T]) LowerBoundIterator() *LowerBoundIterator[T] { } func (n *Node48[T]) incrementLazyRefCount(inc int64) { - n.lazyRefCount += inc + atomic.AddInt64(&n.lazyRefCount, inc) } func (n *Node48[T]) processRefCount() { @@ -253,7 +253,7 @@ func (n *Node48[T]) processRefCount() { child.incrementLazyRefCount(n.lazyRefCount) } } - n.lazyRefCount = 0 + atomic.StoreInt64(&n.lazyRefCount, 0) } func (n *Node48[T]) getRefCount() int64 { diff --git a/node_leaf.go b/node_leaf.go index fb2a9a7..7f37dfa 100644 --- a/node_leaf.go +++ b/node_leaf.go @@ -206,12 +206,12 @@ func (n *NodeLeaf[T]) LowerBoundIterator() *LowerBoundIterator[T] { } func (n *NodeLeaf[T]) incrementLazyRefCount(inc int64) { - n.lazyRefCount += inc + atomic.AddInt64(&n.lazyRefCount, inc) } func (n *NodeLeaf[T]) processRefCount() { n.refCount += n.lazyRefCount - n.lazyRefCount = 0 + atomic.StoreInt64(&n.lazyRefCount, 0) } func (n *NodeLeaf[T]) getRefCount() int64 {