sessiond: ust-registry-channel.cpp: iterate on lfht using lfht_iteration_adapter
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 26 Jul 2024 21:20:18 +0000 (21:20 +0000)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 30 Jul 2024 01:26:51 +0000 (01:26 +0000)
Change-Id: Ie415952021ef795259b9290e4b16d68051403524
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/ust-registry-channel.cpp

index 29c90756f197baa22fa945feb066b2120011bc70..a77e335c847db1b648b95360ea8615b36227dcb7 100644 (file)
@@ -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<const lttng::sessiond::ust::registry_event *> 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<lsu::registry_event,
+                                           decltype(lsu::registry_event::_node),
+                                           &lsu::registry_event::_node>
+               events_view(*_events->ht);
+
+       /* Copy the event ptrs from the _events ht to this vector which we'll sort. */
+       std::vector<const lttng::sessiond::ust::registry_event *> sorted_event_classes(
+               events_view.begin(), events_view.end());
 
        std::sort(sorted_event_classes.begin(),
                  sorted_event_classes.end(),
This page took 0.025952 seconds and 4 git commands to generate.