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

index 8925db4f9875f388b90da8466adf43b915da96d1..fa98f5f0b001361e381f5de136b3bc6c31779bbd 100644 (file)
@@ -61,8 +61,6 @@ static void update_agent_app(const struct agent_app *app)
 {
        struct ltt_session *session, *stmp;
        struct ltt_session_list *list;
-       struct agent *trigger_agent;
-       struct lttng_ht_iter iter;
 
        list = session_get_list();
        LTTNG_ASSERT(list);
@@ -86,17 +84,14 @@ static void update_agent_app(const struct agent_app *app)
                session_put(session);
        }
 
-       {
-               /*
-                * We are protected against the addition of new events by the session
-                * list lock being held.
-                */
-               const lttng::urcu::read_lock_guard read_lock;
-
-               cds_lfht_for_each_entry (
-                       the_trigger_agents_ht_by_domain->ht, &iter.iter, trigger_agent, node.node) {
-                       agent_update(trigger_agent, app);
-               }
+       /*
+        * We are protected against the addition of new events by the session
+        * list lock being held.
+        */
+       for (auto *trigger_agent :
+            lttng::urcu::lfht_iteration_adapter<agent, decltype(agent::node), &agent::node>(
+                    *the_trigger_agents_ht_by_domain->ht)) {
+               agent_update(trigger_agent, app);
        }
 }
 
This page took 0.025741 seconds and 4 git commands to generate.