X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=urcu%2Fstatic%2Flfstack.h;fp=urcu%2Fstatic%2Flfstack.h;h=9531de5bb951f31c47bfc51ef2f8ff9a343cc0fc;hb=32921450bb2907c334b868799d2de0a8f165302a;hp=63af91adf301918b0331eb3cf55c0c52c5f9711f;hpb=d3afe03932758e40b6548480fc5cd04d0811e620;p=userspace-rcu.git diff --git a/urcu/static/lfstack.h b/urcu/static/lfstack.h index 63af91a..9531de5 100644 --- a/urcu/static/lfstack.h +++ b/urcu/static/lfstack.h @@ -36,6 +36,8 @@ extern "C" { #endif +#define CDS_LFS_END NULL + /* * Lock-free stack. * @@ -73,7 +75,7 @@ void _cds_lfs_init(struct cds_lfs_stack *s) { int ret; - s->head = NULL; + s->head = CDS_LFS_END; ret = pthread_mutex_init(&s->lock, NULL); assert(!ret); } @@ -84,13 +86,13 @@ void _cds_lfs_init(struct cds_lfs_stack *s) static inline void ___cds_lfs_init(struct __cds_lfs_stack *s) { - s->head = NULL; + s->head = CDS_LFS_END; } static inline bool ___cds_lfs_empty_head(struct cds_lfs_head *head) { - return head == NULL; + return head == CDS_LFS_END; } /* @@ -138,7 +140,7 @@ bool _cds_lfs_push(cds_lfs_stack_ptr_t u_s, struct cds_lfs_node *node) { struct __cds_lfs_stack *s = u_s._s; - struct cds_lfs_head *head = NULL; + struct cds_lfs_head *head = CDS_LFS_END; struct cds_lfs_head *new_head = caa_container_of(node, struct cds_lfs_head, node); @@ -237,7 +239,7 @@ struct cds_lfs_head *___cds_lfs_pop_all(cds_lfs_stack_ptr_t u_s) * taking care to order writes to each node prior to the full * memory barrier after this uatomic_xchg(). */ - return uatomic_xchg(&s->head, NULL); + return uatomic_xchg(&s->head, CDS_LFS_END); } /*