X-Git-Url: https://git.lttng.org/?p=urcu.git;a=blobdiff_plain;f=urcu%2Frculfstack-static.h;h=7caf3c8c0d15f344170c33873f4cb6f4b4d107fa;hp=f541d40508f1ee05d3f046cb0f0d5add5f18c48c;hb=d9b52143813e104eeee1e3d90061042230b7b5bf;hpb=f7a3d9d917966b0acb45399a66d42dd7e7acb0ca diff --git a/urcu/rculfstack-static.h b/urcu/rculfstack-static.h index f541d40..7caf3c8 100644 --- a/urcu/rculfstack-static.h +++ b/urcu/rculfstack-static.h @@ -61,6 +61,8 @@ 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. + * * 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. @@ -71,22 +73,18 @@ _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; } }