From: Mathieu Desnoyers Date: Fri, 24 Aug 2012 21:29:52 +0000 (-0400) Subject: hlist: implement cds_hlist_first_entry_rcu X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=df65c98a4b6a3c3ba5e55c448521605fe14b6ec3;p=urcu.git hlist: implement cds_hlist_first_entry_rcu Signed-off-by: Mathieu Desnoyers --- 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.