wfstack: push returns prior stack emptiness state
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 1 Sep 2011 13:31:55 +0000 (09:31 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 1 Sep 2011 13:31:55 +0000 (09:31 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
urcu/static/wfstack.h
urcu/wfstack.h
wfstack.c

index 79ed3f774446e042de152ed7c04a7a43cf5aa65b..cb68a59a16d8dc270355d1b6b29506d2120c812f 100644 (file)
@@ -56,8 +56,11 @@ void _cds_wfs_init(struct cds_wfs_stack *s)
        assert(!ret);
 }
 
+/*
+ * Returns 0 if stack was empty, 1 otherwise.
+ */
 static inline
-void _cds_wfs_push(struct cds_wfs_stack *s, struct cds_wfs_node *node)
+int _cds_wfs_push(struct cds_wfs_stack *s, struct cds_wfs_node *node)
 {
        struct cds_wfs_node *old_head;
 
@@ -72,6 +75,7 @@ void _cds_wfs_push(struct cds_wfs_stack *s, struct cds_wfs_node *node)
         * until node->next is set to old_head.
         */
        CMM_STORE_SHARED(node->next, old_head);
+       return (old_head != CDS_WF_STACK_END);
 }
 
 /*
index 354646dfb4237bf626478d2291de52bb2f47fbf1..db2ee0c005a85b261997bc10a3a1c72bcb73a809 100644 (file)
@@ -54,7 +54,7 @@ struct cds_wfs_stack {
 
 extern void cds_wfs_node_init(struct cds_wfs_node *node);
 extern void cds_wfs_init(struct cds_wfs_stack *s);
-extern void cds_wfs_push(struct cds_wfs_stack *s, struct cds_wfs_node *node);
+extern int cds_wfs_push(struct cds_wfs_stack *s, struct cds_wfs_node *node);
 /* __cds_wfs_pop_blocking: caller ensures mutual exclusion between pops */
 extern struct cds_wfs_node *__cds_wfs_pop_blocking(struct cds_wfs_stack *s);
 extern struct cds_wfs_node *cds_wfs_pop_blocking(struct cds_wfs_stack *s);
index d999a5b433dee30a979a5c99c31e20680e2ace81..e9799e6d67b2a1a9b58f6912a7b95576810e6fcb 100644 (file)
--- a/wfstack.c
+++ b/wfstack.c
@@ -38,9 +38,9 @@ void cds_wfs_init(struct cds_wfs_stack *s)
        _cds_wfs_init(s);
 }
 
-void cds_wfs_push(struct cds_wfs_stack *s, struct cds_wfs_node *node)
+int cds_wfs_push(struct cds_wfs_stack *s, struct cds_wfs_node *node)
 {
-       _cds_wfs_push(s, node);
+       return _cds_wfs_push(s, node);
 }
 
 struct cds_wfs_node *__cds_wfs_pop_blocking(struct cds_wfs_stack *s)
This page took 0.026264 seconds and 4 git commands to generate.