ck_ring: Serialize producer snapshot with respect to consumer.

ck_pring
Samy Al Bahra 12 years ago
parent b07c7808ce
commit d595bafea7

@ -246,6 +246,12 @@ ck_ring_dequeue_spmc(struct ck_ring *ring, void *data)
do { do {
position = consumer & ring->mask; 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); producer = ck_pr_load_uint(&ring->p_tail);
if (position == producer) if (position == producer)

Loading…
Cancel
Save