X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=urcu%2Frcuhlist.h;h=1dcbdb4eecbc35207ba85c8c47af7a49d82f1f9f;hb=c76c77cb74e78ee5916ca7a86d0b164124d62337;hp=8549550e7fab3358fd031b30ed87ff67244f1472;hpb=bdffa73aa208ad5f1e5b3a3cb6cbf86ac6996559;p=userspace-rcu.git diff --git a/urcu/rcuhlist.h b/urcu/rcuhlist.h index 8549550..1dcbdb4 100644 --- a/urcu/rcuhlist.h +++ b/urcu/rcuhlist.h @@ -50,8 +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) \ + 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) \ + 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) \ + 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. */