lfstack: introduce CDS_LFS_END define
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 22 Oct 2014 10:49:55 +0000 (06:49 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 22 Oct 2014 10:49:55 +0000 (06:49 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu/static/lfstack.h

index 63af91adf301918b0331eb3cf55c0c52c5f9711f..9531de5bb951f31c47bfc51ef2f8ff9a343cc0fc 100644 (file)
@@ -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);
 }
 
 /*
This page took 0.026272 seconds and 4 git commands to generate.