X-Git-Url: http://git.liburcu.org/?p=userspace-rcu.git;a=blobdiff_plain;f=urcu%2Fhlist.h;h=f8624b1697406a05659f70706d72deacf5c65188;hp=344481133eac2051f4d7ab85e6188f51887e7dd7;hb=refs%2Fheads%2Furcu%2Frcuja-range;hpb=79efd9b350e07a499b3620ddde4860b8378fcf00 diff --git a/urcu/hlist.h b/urcu/hlist.h index 3444811..f8624b1 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,