Skip to content

Commit 9ffee08

Browse files
committed
use atomic loads in critnib find_pre/succ
1 parent 0a05415 commit 9ffee08

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/critnib/critnib.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,6 @@ find_predecessor(struct critnib_node *__restrict n) {
537537
}
538538

539539
utils_atomic_load_acquire_ptr((void **)&n->child[nib], (void **)&n);
540-
541540
if (!n) {
542541
return NULL;
543542
}
@@ -644,7 +643,9 @@ void *critnib_find_le(struct critnib *c, word key) {
644643
static struct critnib_leaf *find_successor(struct critnib_node *__restrict n) {
645644
while (1) {
646645
unsigned nib;
646+
struct critnib_node *m = NULL;
647647
for (nib = 0; nib <= NIB; nib++) {
648+
utils_atomic_load_acquire_ptr((void **)&n->child[nib], (void **)&m);
648649
if (n->child[nib]) {
649650
break;
650651
}
@@ -654,8 +655,7 @@ static struct critnib_leaf *find_successor(struct critnib_node *__restrict n) {
654655
return NULL;
655656
}
656657

657-
n = n->child[nib];
658-
658+
utils_atomic_load_acquire_ptr((void **)&n->child[nib], (void **)&n);
659659
if (!n) {
660660
return NULL;
661661
}

0 commit comments

Comments
 (0)