- rcu_read_lock();
- for (;;) {
- struct rcu_lfs_node *head = rcu_dereference(s->head);
-
- if (head) {
- struct rcu_lfs_node *next = rcu_dereference(head->next);
-
- if (uatomic_cmpxchg(&s->head, head, next) == head) {
- rcu_read_unlock();
- return head;
- } else {
- /* Concurrent modification. Retry. */
- continue;
- }
- } else {
- /* Empty stack */
- rcu_read_unlock();
- return NULL;
- }
- }
+ return _cds_lfs_pop_rcu(s);
+}
+
+#else /* !_LGPL_SOURCE */
+
+extern CDS_LFS_RCU_DEPRECATED
+void cds_lfs_node_init_rcu(struct cds_lfs_node_rcu *node);
+extern CDS_LFS_RCU_DEPRECATED
+void cds_lfs_init_rcu(struct cds_lfs_stack_rcu *s);
+extern CDS_LFS_RCU_DEPRECATED
+int cds_lfs_push_rcu(struct cds_lfs_stack_rcu *s,
+ struct cds_lfs_node_rcu *node);
+
+/*
+ * Should be called under rcu read lock critical section.
+ *
+ * The caller must wait for a grace period to pass before freeing the returned
+ * node or modifying the cds_lfs_node_rcu structure.
+ * Returns NULL if stack is empty.
+ */
+extern CDS_LFS_RCU_DEPRECATED
+struct cds_lfs_node_rcu *cds_lfs_pop_rcu(struct cds_lfs_stack_rcu *s);
+
+#endif /* !_LGPL_SOURCE */
+
+#ifdef __cplusplus