consumerd: ust-consumer.cpp: iterate on lfht using lfht_iteration_adapter
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 26 Jul 2024 21:49:06 +0000 (21:49 +0000)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 30 Jul 2024 18:26:44 +0000 (14:26 -0400)
Change-Id: Idbbfd6be4666bca420faf408241f5f195818981a
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/ust-consumer/ust-consumer.cpp

index 93686e75a7166116e5448b580aa7d9a2b904ff86..8d3bc882af13e587ada2438c9fe39baac1d37804 100644 (file)
@@ -3195,24 +3195,20 @@ end:
  */
 void lttng_ustconsumer_close_all_metadata(struct lttng_ht *metadata_ht)
 {
-       struct lttng_ht_iter iter;
-       struct lttng_consumer_stream *stream;
-
        LTTNG_ASSERT(metadata_ht);
        LTTNG_ASSERT(metadata_ht->ht);
 
        DBG("UST consumer closing all metadata streams");
 
-       {
-               const lttng::urcu::read_lock_guard read_lock;
-
-               cds_lfht_for_each_entry (metadata_ht->ht, &iter.iter, stream, node.node) {
-                       health_code_update();
+       for (auto *stream :
+            lttng::urcu::lfht_iteration_adapter<lttng_consumer_stream,
+                                                decltype(lttng_consumer_stream::node),
+                                                &lttng_consumer_stream::node>(*metadata_ht->ht)) {
+               health_code_update();
 
-                       pthread_mutex_lock(&stream->chan->lock);
-                       lttng_ustconsumer_close_metadata(stream->chan);
-                       pthread_mutex_unlock(&stream->chan->lock);
-               }
+               pthread_mutex_lock(&stream->chan->lock);
+               lttng_ustconsumer_close_metadata(stream->chan);
+               pthread_mutex_unlock(&stream->chan->lock);
        }
 }
 
This page took 0.026736 seconds and 4 git commands to generate.