ck_{ring,fifo}: Add store fences while we lack load_store fences.

ck_pring
Samy Al Bahra 12 years ago
parent e78bbe9ae6
commit 955047a7d1

@ -144,6 +144,8 @@ ck_fifo_spsc_dequeue(struct ck_fifo_spsc *fifo, void *value)
/* If entry is visible, guarantee store to value is visible. */ /* If entry is visible, guarantee store to value is visible. */
ck_pr_fence_load(); ck_pr_fence_load();
ck_pr_store_ptr(value, entry->value); ck_pr_store_ptr(value, entry->value);
ck_pr_fence_store();
ck_pr_store_ptr(&fifo->head, entry); ck_pr_store_ptr(&fifo->head, entry);
return (true); return (true);
} }

@ -108,6 +108,7 @@
\ \
ck_pr_fence_load(); \ ck_pr_fence_load(); \
*data = ring->ring[consumer]; \ *data = ring->ring[consumer]; \
ck_pr_fence_store(); \
ck_pr_store_uint(&ring->c_head, (consumer + 1) & ring->mask); \ ck_pr_store_uint(&ring->c_head, (consumer + 1) & ring->mask); \
\ \
return (true); \ return (true); \
@ -213,6 +214,7 @@ ck_ring_dequeue_spsc(struct ck_ring *ring, void *data)
* before this operation completes. * before this operation completes.
*/ */
ck_pr_store_ptr(data, ring->ring[consumer]); ck_pr_store_ptr(data, ring->ring[consumer]);
ck_pr_fence_store();
ck_pr_store_uint(&ring->c_head, (consumer + 1) & ring->mask); ck_pr_store_uint(&ring->c_head, (consumer + 1) & ring->mask);
return (true); return (true);
} }

Loading…
Cancel
Save