X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;ds=inline;f=urcu%2Fhlist.h;h=15e672bc1702135ddfdb20b5676785dbd3cb2f55;hb=63d2de6a60e9cc108f66f61f0e432741c38f0571;hp=d7d5c87f1c28d1c3710ed1d1bb4a08f0751b3a55;hpb=bdffa73aa208ad5f1e5b3a3cb6cbf86ac6996559;p=userspace-rcu.git diff --git a/urcu/hlist.h b/urcu/hlist.h index d7d5c87..15e672b 100644 --- a/urcu/hlist.h +++ b/urcu/hlist.h @@ -39,6 +39,15 @@ static inline 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, struct cds_hlist_head *head)