Replace explicit rcu_read_lock/unlock with lttng::urcu::read_lock_guard
[lttng-tools.git] / src / bin / lttng-sessiond / context.cpp
index b3b549187ecd57fcf5f7d989de230bc00ae6abbf..79c454809cdb3f65f97da0526130c635e16207a2 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <common/error.hpp>
 #include <common/sessiond-comm/sessiond-comm.hpp>
 
 #include <common/error.hpp>
 #include <common/sessiond-comm/sessiond-comm.hpp>
+#include <common/urcu.hpp>
 
 #include <stdio.h>
 #include <unistd.h>
 
 #include <stdio.h>
 #include <unistd.h>
@@ -374,7 +375,7 @@ int context_ust_add(struct ltt_ust_session *usess,
        LTTNG_ASSERT(ctx);
        LTTNG_ASSERT(channel_name);
 
        LTTNG_ASSERT(ctx);
        LTTNG_ASSERT(channel_name);
 
-       rcu_read_lock();
+       lttng::urcu::read_lock_guard read_lock;
 
        chan_ht = usess->domain_global.channels;
 
 
        chan_ht = usess->domain_global.channels;
 
@@ -391,7 +392,6 @@ int context_ust_add(struct ltt_ust_session *usess,
                /* Add ctx to channel */
                ret = add_uctx_to_channel(usess, domain, uchan, ctx);
        } else {
                /* Add ctx to channel */
                ret = add_uctx_to_channel(usess, domain, uchan, ctx);
        } else {
-               rcu_read_lock();
                /* Add ctx all events, all channels */
                cds_lfht_for_each_entry (chan_ht->ht, &iter.iter, uchan, node.node) {
                        ret = add_uctx_to_channel(usess, domain, uchan, ctx);
                /* Add ctx all events, all channels */
                cds_lfht_for_each_entry (chan_ht->ht, &iter.iter, uchan, node.node) {
                        ret = add_uctx_to_channel(usess, domain, uchan, ctx);
@@ -400,7 +400,6 @@ int context_ust_add(struct ltt_ust_session *usess,
                                continue;
                        }
                }
                                continue;
                        }
                }
-               rcu_read_unlock();
        }
 
        switch (ret) {
        }
 
        switch (ret) {
@@ -426,6 +425,5 @@ int context_ust_add(struct ltt_ust_session *usess,
        }
 
 error:
        }
 
 error:
-       rcu_read_unlock();
        return ret;
 }
        return ret;
 }
This page took 0.023467 seconds and 4 git commands to generate.