diff --git a/include/ck_ring.h b/include/ck_ring.h index 9c7e3a6..0699706 100644 --- a/include/ck_ring.h +++ b/include/ck_ring.h @@ -246,6 +246,12 @@ ck_ring_dequeue_spmc(struct ck_ring *ring, void *data) do { position = consumer & ring->mask; + + /* + * Producer counter must represent state relative to + * our latest consumer snapshot. + */ + ck_pr_fence_load(); producer = ck_pr_load_uint(&ring->p_tail); if (position == producer)