From 955047a7d14073bb2a42c807a06d4d368d3996e3 Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Thu, 23 Aug 2012 13:48:08 -0400 Subject: [PATCH] ck_{ring,fifo}: Add store fences while we lack load_store fences. --- include/ck_fifo.h | 2 ++ include/ck_ring.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/ck_fifo.h b/include/ck_fifo.h index edb2059..707bc1e 100644 --- a/include/ck_fifo.h +++ b/include/ck_fifo.h @@ -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. */ ck_pr_fence_load(); ck_pr_store_ptr(value, entry->value); + + ck_pr_fence_store(); ck_pr_store_ptr(&fifo->head, entry); return (true); } diff --git a/include/ck_ring.h b/include/ck_ring.h index 14f6380..077d94a 100644 --- a/include/ck_ring.h +++ b/include/ck_ring.h @@ -108,6 +108,7 @@ \ ck_pr_fence_load(); \ *data = ring->ring[consumer]; \ + ck_pr_fence_store(); \ ck_pr_store_uint(&ring->c_head, (consumer + 1) & ring->mask); \ \ return (true); \ @@ -213,6 +214,7 @@ ck_ring_dequeue_spsc(struct ck_ring *ring, void *data) * before this operation completes. */ ck_pr_store_ptr(data, ring->ring[consumer]); + ck_pr_fence_store(); ck_pr_store_uint(&ring->c_head, (consumer + 1) & ring->mask); return (true); }