X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=urcu%2Fhlist.h;fp=urcu%2Fhlist.h;h=d2e2ec38e2304f24e8ad86c18389e7faf3154508;hb=9f446823a2f64fbc9b9af984dc797c73f4107310;hp=9f4332ac87d9afd33e48e5de6dcd3c4a96d5da88;hpb=98f483d24f69785a7fb2e988f1053c34e84a4e61;p=userspace-rcu.git diff --git a/urcu/hlist.h b/urcu/hlist.h index 9f4332a..d2e2ec3 100644 --- a/urcu/hlist.h +++ b/urcu/hlist.h @@ -43,6 +43,16 @@ void CDS_INIT_HLIST_HEAD(struct cds_hlist_head *ptr) #define cds_hlist_entry(ptr, type, member) \ ((type *) ((char *) (ptr) - (unsigned long) (&((type *) 0)->member))) +/* Get first entry from a list. Assumes the hlist is not empty. */ +#define cds_hlist_first_entry(ptr, type, member) \ + cds_list_entry((ptr)->next, type, member) + +static inline +int cds_hlist_empty(struct cds_hlist_head *head) +{ + return !head->next; +} + /* Add new element at the head of the list. */ static inline void cds_hlist_add_head(struct cds_hlist_node *newp,