ck_hp: Remove barrier from set and allow user to batch.

A user may want to batch multiple slot updates. Enforcing strong
semantics in set would not allow this.
ck_pring
Samy Al Bahra 14 years ago
parent dffbb4b48f
commit d7d1dfbf50

@ -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_store_ptr(&record->pointers[i], pointer);
ck_pr_fence_store();
return; return;
} }

@ -82,6 +82,7 @@ ck_hp_fifo_enqueue_mpmc(ck_hp_record_t *record,
for (;;) { for (;;) {
tail = ck_pr_load_ptr(&fifo->tail); tail = ck_pr_load_ptr(&fifo->tail);
ck_hp_set(record, 0, tail); ck_hp_set(record, 0, tail);
ck_pr_fence_memory();
if (tail != ck_pr_load_ptr(&fifo->tail)) if (tail != ck_pr_load_ptr(&fifo->tail))
continue; continue;
@ -108,6 +109,7 @@ ck_hp_fifo_dequeue_mpmc(ck_hp_record_t *record,
head = ck_pr_load_ptr(&fifo->head); head = ck_pr_load_ptr(&fifo->head);
ck_hp_set(record, 0, head); ck_hp_set(record, 0, head);
ck_pr_fence_memory();
if (head != ck_pr_load_ptr(&fifo->head)) if (head != ck_pr_load_ptr(&fifo->head))
continue; continue;

@ -57,6 +57,7 @@ ck_hp_stack_pop_mpmc(ck_hp_record_t *record, struct ck_stack *target)
return (NULL); return (NULL);
ck_hp_set(record, 0, entry); ck_hp_set(record, 0, entry);
ck_pr_fence_memory();
} while (entry != ck_pr_load_ptr(&target->head)); } while (entry != ck_pr_load_ptr(&target->head));
while (ck_pr_cas_ptr_value(&target->head, entry, entry->next, &entry) == false) { 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); return (NULL);
ck_hp_set(record, 0, entry); ck_hp_set(record, 0, entry);
ck_pr_fence_memory();
update = ck_pr_load_ptr(&target->head); update = ck_pr_load_ptr(&target->head);
while (entry != update) { while (entry != update) {
ck_hp_set(record, 0, update); ck_hp_set(record, 0, update);
ck_pr_fence_memory();
entry = update; entry = update;
update = ck_pr_load_ptr(&target->head); update = ck_pr_load_ptr(&target->head);
if (update == NULL) if (update == NULL)

Loading…
Cancel
Save