From 707c65a80f4bc33d6eb335f1128453dc60658232 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Fri, 1 Jul 2011 17:42:48 -0400 Subject: [PATCH] rculfqueue: Document dummy pointer value access Signed-off-by: Mathieu Desnoyers --- urcu/static/rculfqueue.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/urcu/static/rculfqueue.h b/urcu/static/rculfqueue.h index 0970c0f..6045c18 100644 --- a/urcu/static/rculfqueue.h +++ b/urcu/static/rculfqueue.h @@ -62,7 +62,7 @@ struct cds_lfq_node_rcu_dummy { static inline int is_dummy(struct cds_lfq_queue_rcu *q, struct cds_lfq_node_rcu *node) { - return node == q->dummy; + return node == CMM_LOAD_SHARED(q->dummy); } static inline @@ -203,9 +203,13 @@ struct cds_lfq_node_rcu *_cds_lfq_dequeue_rcu(struct cds_lfq_queue_rcu *q) /* * We are the only thread * allowed to update dummy (we - * own the old dummy). + * own the old dummy). Other + * dequeue threads read it + * concurrently with RCU + * read-lock held, which + * protects from ABA. */ - q->dummy = node; + CMM_STORE_SHARED(q->dummy, node); _cds_lfq_enqueue_rcu(q, node); continue; /* try again */ } -- 2.34.1