X-Git-Url: https://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=urcu%2Fstatic%2Frculfstack.h;h=3473ccef82299b0b41559734e75377b2ac0f1941;hp=1df121b461389fbb0b621e6eeefb37c4b4e131eb;hb=4157e1ac43033c8b3ef5405b9c01e8311b2454ca;hpb=e1a3b81e201ccfd019dae3778bd6ba0bd1e545e4 diff --git a/urcu/static/rculfstack.h b/urcu/static/rculfstack.h index 1df121b..3473cce 100644 --- a/urcu/static/rculfstack.h +++ b/urcu/static/rculfstack.h @@ -27,6 +27,7 @@ */ #include +#include #ifdef __cplusplus extern "C" { @@ -90,7 +91,7 @@ int _cds_lfs_push_rcu(struct cds_lfs_stack_rcu *s, } /* - * Acts as a RCU reader. + * 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. @@ -103,22 +104,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; } }