From 5d129d67a0c7377eb851f5ecea28c7c6c0aa252a Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Fri, 26 Jul 2024 20:43:11 +0000 Subject: [PATCH] sessiond: manage-kernel.cpp: iterate on lfht using lfht_iteration_adapter MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Change-Id: Id6a47ca1971f48dec5563085fa9e5affd48a1567 Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/manage-kernel.cpp | 29 +++++++++--------------- 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/src/bin/lttng-sessiond/manage-kernel.cpp b/src/bin/lttng-sessiond/manage-kernel.cpp index 70a750aec..568449516 100644 --- a/src/bin/lttng-sessiond/manage-kernel.cpp +++ b/src/bin/lttng-sessiond/manage-kernel.cpp @@ -105,9 +105,6 @@ static int update_kernel_stream(int fd) ksess = session->kernel_session; cds_list_for_each_entry (channel, &ksess->channel_list.head, list) { - struct lttng_ht_iter iter; - struct consumer_socket *socket; - if (channel->fd != fd) { continue; } @@ -129,21 +126,17 @@ static int update_kernel_stream(int fd) goto error; } - { - const lttng::urcu::read_lock_guard read_lock; - - cds_lfht_for_each_entry ( - ksess->consumer->socks->ht, &iter.iter, socket, node.node) { - pthread_mutex_lock(socket->lock); - ret = kernel_consumer_send_channel_streams( - socket, - channel, - ksess, - session->output_traces ? 1 : 0); - pthread_mutex_unlock(socket->lock); - if (ret < 0) { - goto error; - } + for (auto *socket : + lttng::urcu::lfht_iteration_adapter( + *ksess->consumer->socks->ht)) { + pthread_mutex_lock(socket->lock); + ret = kernel_consumer_send_channel_streams( + socket, channel, ksess, session->output_traces ? 1 : 0); + pthread_mutex_unlock(socket->lock); + if (ret < 0) { + goto error; } } } -- 2.34.1