cds containers: lfqueue and lfstack: don't depend on a particular rcu flavor
[urcu.git] / urcu / rculfstack-static.h
index 3ce24c55d2ddcf385f9e90006a016b305b557766..7caf3c8c0d15f344170c33873f4cb6f4b4d107fa 100644 (file)
 extern "C" {
 #endif
 
-void _rcu_lfs_node_init(struct rcu_lfs_node *node)
+void _cds_lfs_node_init_rcu(struct cds_lfs_node_rcu *node)
 {
 }
 
-void _rcu_lfs_init(struct rcu_lfs_stack *s)
+void _cds_lfs_init_rcu(struct cds_lfs_stack_rcu *s)
 {
        s->head = NULL;
 }
 
-void _rcu_lfs_push(struct rcu_lfs_stack *s, struct rcu_lfs_node *node)
+void _cds_lfs_push_rcu(struct cds_lfs_stack_rcu *s, struct cds_lfs_node_rcu *node)
 {
-       struct rcu_lfs_node *head = NULL;
+       struct cds_lfs_node_rcu *head = NULL;
 
        for (;;) {
-               struct rcu_lfs_node *old_head = head;
+               struct cds_lfs_node_rcu *old_head = head;
 
                node->next = head;
                /*
@@ -61,32 +61,30 @@ void _rcu_lfs_push(struct rcu_lfs_stack *s, struct rcu_lfs_node *node)
 }
 
 /*
+ * Should be called under rcu read-side lock.
+ *
  * The caller must wait for a grace period to pass before freeing the returned
- * node or modifying the rcu_lfs_node structure.
+ * node or modifying the cds_lfs_node_rcu structure.
  * Returns NULL if stack is empty.
  */
-struct rcu_lfs_node *
-_rcu_lfs_pop(struct rcu_lfs_stack *s)
+struct cds_lfs_node_rcu *
+_cds_lfs_pop_rcu(struct cds_lfs_stack_rcu *s)
 {
        for (;;) {
-               struct rcu_lfs_node *head;
+               struct cds_lfs_node_rcu *head;
 
-               rcu_read_lock();
                head = rcu_dereference(s->head);
                if (head) {
-                       struct rcu_lfs_node *next = rcu_dereference(head->next);
+                       struct cds_lfs_node_rcu *next = rcu_dereference(head->next);
 
                        if (uatomic_cmpxchg(&s->head, head, next) == head) {
-                               rcu_read_unlock();
                                return head;
                        } else {
                                /* Concurrent modification. Retry. */
-                               rcu_read_unlock();
                                continue;
                        }
                } else {
                        /* Empty stack */
-                       rcu_read_unlock();
                        return NULL;
                }
        }
This page took 0.024457 seconds and 4 git commands to generate.