- rcu_read_lock();
- cds_lfht_for_each_entry(ht->ht, &iter.iter, node, node) {
- /* Remove from ordered list. */
- ctx = lttng::utils::container_of(node, <t_ust_context::node);
- cds_list_del(&ctx->list);
- /* Remove from channel's hash table. */
- ret = lttng_ht_del(ht, &iter);
- if (!ret) {
- call_rcu(&node->head, destroy_context_rcu);
+ {
+ lttng::urcu::read_lock_guard read_lock;
+
+ cds_lfht_for_each_entry (ht->ht, &iter.iter, node, node) {
+ /* Remove from ordered list. */
+ ctx = lttng::utils::container_of(node, <t_ust_context::node);
+ cds_list_del(&ctx->list);
+ /* Remove from channel's hash table. */
+ ret = lttng_ht_del(ht, &iter);
+ if (!ret) {
+ call_rcu(&node->head, destroy_context_rcu);
+ }