From: Jérémie Galarneau Date: Fri, 26 Jul 2024 21:20:18 +0000 (+0000) Subject: sessiond: ust-registry-channel.cpp: iterate on lfht using lfht_iteration_adapter X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=ed7fa91d0e587c270335c8fbdae83910c4ef4c77;p=lttng-tools.git sessiond: ust-registry-channel.cpp: iterate on lfht using lfht_iteration_adapter Change-Id: Ie415952021ef795259b9290e4b16d68051403524 Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/ust-registry-channel.cpp b/src/bin/lttng-sessiond/ust-registry-channel.cpp index 29c90756f..a77e335c8 100644 --- a/src/bin/lttng-sessiond/ust-registry-channel.cpp +++ b/src/bin/lttng-sessiond/ust-registry-channel.cpp @@ -497,20 +497,14 @@ void lsu::registry_channel::set_as_registered() void lsu::registry_channel::_accept_on_event_classes( lttng::sessiond::trace::trace_class_visitor& visitor) const { - std::vector sorted_event_classes; - - { - const lttng::urcu::read_lock_guard read_lock_guard; - struct lttng_ht_iter iter; - const lttng::sessiond::ust::registry_event *event; - - DIAGNOSTIC_PUSH - DIAGNOSTIC_IGNORE_INVALID_OFFSETOF - cds_lfht_for_each_entry (_events->ht, &iter.iter, event, _node) { - sorted_event_classes.emplace_back(event); - } - DIAGNOSTIC_POP - } + const lttng::urcu::lfht_iteration_adapter + events_view(*_events->ht); + + /* Copy the event ptrs from the _events ht to this vector which we'll sort. */ + std::vector sorted_event_classes( + events_view.begin(), events_view.end()); std::sort(sorted_event_classes.begin(), sorted_event_classes.end(),