hlist: implement non-entry API
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sun, 26 Aug 2012 00:57:24 +0000 (20:57 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 14 May 2013 14:22:23 +0000 (16:22 +0200)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu/rcuhlist.h

index 4635593b4cb00449dd1fe82ebc70e70da3743cef..06359d5b2bd95d15296132c8c260a1abae5d90e1 100644 (file)
@@ -50,14 +50,32 @@ static inline void cds_hlist_del_rcu(struct cds_hlist_node *elem)
        elem->prev->next = elem->next;
 }
 
+/*
+ * Get first element from a RCU hlist. Assumes the hlist is not empty.
+ * This must be done while rcu_read_lock() is held.
+ */
+#define cds_hlist_first_rcu(ptr, type, member)                         \
+       rcu_dereference((ptr)->next)
+
 /*
  * Get first entry from a RCU hlist. Assumes the hlist is not empty.
  * This must be done while rcu_read_lock() is held.
  */
-#define cds_hlist_first_entry_rcu(ptr, type, member) \
+#define cds_hlist_first_entry_rcu(ptr, type, member)                   \
        cds_hlist_entry(rcu_dereference((ptr)->next), type, member)
 
-/* Iterate through elements of the list.
+/*
+ * Iterate through nodes of the list.
+ * This must be done while rcu_read_lock() is held.
+ */
+
+#define cds_hlist_for_each_rcu(pos, head, member)                      \
+       for (pos = rcu_dereference((head)->next);                       \
+            pos != NULL;                                               \
+            pos = rcu_dereference(pos->next))
+
+/*
+ * Iterate through elements of the list.
  * This must be done while rcu_read_lock() is held.
  */
 
This page took 0.025882 seconds and 4 git commands to generate.