From df65c98a4b6a3c3ba5e55c448521605fe14b6ec3 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Fri, 24 Aug 2012 17:29:52 -0400 Subject: [PATCH] hlist: implement cds_hlist_first_entry_rcu Signed-off-by: Mathieu Desnoyers --- urcu/rcuhlist.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/urcu/rcuhlist.h b/urcu/rcuhlist.h index 8549550..4635593 100644 --- a/urcu/rcuhlist.h +++ b/urcu/rcuhlist.h @@ -50,6 +50,12 @@ static inline void cds_hlist_del_rcu(struct cds_hlist_node *elem) elem->prev->next = elem->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) \ + cds_hlist_entry(rcu_dereference((ptr)->next), type, member) /* Iterate through elements of the list. * This must be done while rcu_read_lock() is held. -- 2.34.1