From: Jérémie Galarneau Date: Fri, 26 Jul 2024 20:43:11 +0000 (+0000) Subject: sessiond: manage-kernel.cpp: iterate on lfht using lfht_iteration_adapter X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=5d129d67a0c7377eb851f5ecea28c7c6c0aa252a;p=lttng-tools.git sessiond: manage-kernel.cpp: iterate on lfht using lfht_iteration_adapter Change-Id: Id6a47ca1971f48dec5563085fa9e5affd48a1567 Signed-off-by: Jérémie Galarneau --- 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; } } }