Skip to content

Commit

Permalink
Dev to Main (#28)
Browse files Browse the repository at this point in the history
* fix go mod tidy

* fix go mod tidy (#21)

* Dev to Main (#23)

* fix go mod tidy

* fix go mod tidy (#21)

* fix iterator

* lazy cow and mutations:

* removed old chan

* revert decrement iter

* fix mutate chn bug

* trying fix race
  • Loading branch information
absolutelightning authored May 28, 2024
1 parent 6a1f106 commit 8e9b3e7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion node_16.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ func (n *Node16[T]) getRefCount() int32 {
}

func (n *Node16[T]) processLazyRef() {
atomic.AddInt32(&n.refCount, n.lazyRefCount)
lazyRefCount := atomic.LoadInt32(&n.lazyRefCount)
atomic.AddInt32(&n.refCount, lazyRefCount)
for i := 0; i < 16; i++ {
if n.children[i] != nil {
n.children[i].incrementLazyRefCount(n.lazyRefCount)
Expand Down
3 changes: 2 additions & 1 deletion node_256.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ func (n *Node256[T]) getRefCount() int32 {
}

func (n *Node256[T]) processLazyRef() {
atomic.AddInt32(&n.refCount, n.lazyRefCount)
lazyRefCount := atomic.LoadInt32(&n.lazyRefCount)
atomic.AddInt32(&n.refCount, lazyRefCount)
for i := 0; i < 256; i++ {
if n.children[i] != nil {
n.children[i].incrementLazyRefCount(n.lazyRefCount)
Expand Down
3 changes: 2 additions & 1 deletion node_4.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ func (n *Node4[T]) getRefCount() int32 {
}

func (n *Node4[T]) processLazyRef() {
atomic.AddInt32(&n.refCount, n.lazyRefCount)
lazyRefCount := atomic.LoadInt32(&n.lazyRefCount)
atomic.AddInt32(&n.refCount, lazyRefCount)
for i := 0; i < 4; i++ {
if n.children[i] != nil {
n.children[i].incrementLazyRefCount(n.lazyRefCount)
Expand Down
3 changes: 2 additions & 1 deletion node_48.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ func (n *Node48[T]) setRefCount(val int32) {
}

func (n *Node48[T]) processLazyRef() {
atomic.AddInt32(&n.refCount, n.lazyRefCount)
lazyRefCount := atomic.LoadInt32(&n.lazyRefCount)
atomic.AddInt32(&n.refCount, lazyRefCount)
for i := 0; i < 48; i++ {
if n.children[i] != nil {
n.children[i].incrementLazyRefCount(n.lazyRefCount)
Expand Down

0 comments on commit 8e9b3e7

Please sign in to comment.