X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=urcu%2Frcuhlist.h;fp=urcu%2Frcuhlist.h;h=b07c66b65ff1ccd33621f08e054594c375127bd7;hb=9f446823a2f64fbc9b9af984dc797c73f4107310;hp=69c4d3184fd50d7f38a730e17447678f5fec3991;hpb=98f483d24f69785a7fb2e988f1053c34e84a4e61;p=userspace-rcu.git diff --git a/urcu/rcuhlist.h b/urcu/rcuhlist.h index 69c4d31..b07c66b 100644 --- a/urcu/rcuhlist.h +++ b/urcu/rcuhlist.h @@ -50,6 +50,20 @@ void cds_hlist_del_rcu(struct cds_hlist_node *elem) CMM_STORE_SHARED(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. * This must be done while rcu_read_lock() is held.