CDS API: removal of rcu_read lock/unlock dep, removal of call_rcu argument from init
[urcu.git] / urcu / static / rculfstack.h
index 3f48b7eabbc33c10a626400fb28dc6d4545c4776..ed6b0d4a6890d7d0f4205106ff5db09627c9f3f1 100644 (file)
@@ -27,7 +27,6 @@
  */
 
 #include <urcu/uatomic.h>
-/* A urcu implementation header should be already included. */
 
 #ifdef __cplusplus
 extern "C" {
@@ -64,7 +63,7 @@ void _cds_lfs_push_rcu(struct cds_lfs_stack_rcu *s, struct cds_lfs_node_rcu *nod
 }
 
 /*
- * Should be called under rcu read-side lock.
+ * Acts as a RCU reader.
  *
  * The caller must wait for a grace period to pass before freeing the returned
  * node or modifying the cds_lfs_node_rcu structure.
@@ -77,18 +76,22 @@ _cds_lfs_pop_rcu(struct cds_lfs_stack_rcu *s)
        for (;;) {
                struct cds_lfs_node_rcu *head;
 
+               rcu_read_lock();
                head = rcu_dereference(s->head);
                if (head) {
                        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.02378 seconds and 4 git commands to generate.