Skip to content

Commit 44e4981

Browse files
committed
Use atomics in find_successor() like in find_predecessor()
Use atomics in find_successor() like in find_predecessor(). Ref: oneapi-src#1175 Signed-off-by: Lukasz Dorau <[email protected]>
1 parent 96d2ef3 commit 44e4981

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/critnib/critnib.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,9 @@ static struct critnib_leaf *find_successor(struct critnib_node *__restrict n) {
645645
while (1) {
646646
unsigned nib;
647647
for (nib = 0; nib <= NIB; nib++) {
648-
if (n->child[nib]) {
648+
struct critnib_node *m;
649+
utils_atomic_load_acquire_ptr((void **)&n->child[nib], (void **)&m);
650+
if (m) {
649651
break;
650652
}
651653
}
@@ -654,7 +656,7 @@ static struct critnib_leaf *find_successor(struct critnib_node *__restrict n) {
654656
return NULL;
655657
}
656658

657-
n = n->child[nib];
659+
utils_atomic_load_acquire_ptr((void **)&n->child[nib], (void **)&n);
658660

659661
if (!n) {
660662
return NULL;

0 commit comments

Comments
 (0)