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

index 598574e659d646bd39bdfe624aa28416c77fb27e..a89a3bff443c563b494807d49e9062ddb274c22d 100644 (file)
@@ -108,25 +108,18 @@ error_ioctl:
  */
 static void destroy_syscall_ht(struct lttng_ht *ht)
 {
-       struct lttng_ht_iter iter;
-       struct syscall *ksyscall;
-
        DBG3("Destroying syscall hash table.");
 
        if (!ht) {
                return;
        }
 
-       {
-               const lttng::urcu::read_lock_guard read_lock;
-
-               cds_lfht_for_each_entry (ht->ht, &iter.iter, ksyscall, node.node) {
-                       int ret;
-
-                       ret = lttng_ht_del(ht, &iter);
-                       LTTNG_ASSERT(!ret);
-                       delete ksyscall;
-               }
+       for (auto *ksyscall : lttng::urcu::lfht_iteration_adapter<struct syscall,
+                                                                 decltype(syscall::node),
+                                                                 &syscall::node>(*ht->ht)) {
+               const auto ret = cds_lfht_del(ht->ht, &ksyscall->node.node);
+               LTTNG_ASSERT(!ret);
+               delete ksyscall;
        }
 
        lttng_ht_destroy(ht);
This page took 0.027246 seconds and 4 git commands to generate.