diff --git a/include/ck_hp.h b/include/ck_hp.h index 4aca5ff..357e3bb 100644 --- a/include/ck_hp.h +++ b/include/ck_hp.h @@ -76,7 +76,6 @@ ck_hp_set(struct ck_hp_record *record, unsigned int i, void *pointer) { ck_pr_store_ptr(&record->pointers[i], pointer); - ck_pr_fence_store(); return; } diff --git a/include/ck_hp_fifo.h b/include/ck_hp_fifo.h index a2ebc57..5006397 100644 --- a/include/ck_hp_fifo.h +++ b/include/ck_hp_fifo.h @@ -82,6 +82,7 @@ ck_hp_fifo_enqueue_mpmc(ck_hp_record_t *record, for (;;) { tail = ck_pr_load_ptr(&fifo->tail); ck_hp_set(record, 0, tail); + ck_pr_fence_memory(); if (tail != ck_pr_load_ptr(&fifo->tail)) continue; @@ -108,6 +109,7 @@ ck_hp_fifo_dequeue_mpmc(ck_hp_record_t *record, head = ck_pr_load_ptr(&fifo->head); ck_hp_set(record, 0, head); + ck_pr_fence_memory(); if (head != ck_pr_load_ptr(&fifo->head)) continue; diff --git a/include/ck_hp_stack.h b/include/ck_hp_stack.h index 3e3d2dc..fb76584 100644 --- a/include/ck_hp_stack.h +++ b/include/ck_hp_stack.h @@ -57,6 +57,7 @@ ck_hp_stack_pop_mpmc(ck_hp_record_t *record, struct ck_stack *target) return (NULL); ck_hp_set(record, 0, entry); + ck_pr_fence_memory(); } while (entry != ck_pr_load_ptr(&target->head)); while (ck_pr_cas_ptr_value(&target->head, entry, entry->next, &entry) == false) { @@ -64,9 +65,11 @@ ck_hp_stack_pop_mpmc(ck_hp_record_t *record, struct ck_stack *target) return (NULL); ck_hp_set(record, 0, entry); + ck_pr_fence_memory(); update = ck_pr_load_ptr(&target->head); while (entry != update) { ck_hp_set(record, 0, update); + ck_pr_fence_memory(); entry = update; update = ck_pr_load_ptr(&target->head); if (update == NULL)