[PATCH] D114845: [llvm] [Debuginfod] DebuginfodCollection and DebuginfodServer for tracking local debuginfo.

Daniel Thornburgh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 17 10:01:20 PDT 2022


mysterymath added inline comments.


================
Comment at: llvm/lib/Debuginfod/Debuginfod.cpp:367-373
+  }
+  {
+    std::unique_lock<std::mutex> Guard(IteratorMutex);
+    // Wait on condition variable indicating directory traversal is complete.
+    IteratorCondition.wait(Guard,
+                           [&] { return (I == E || EC) && !NumActiveWorkers; });
+  }
----------------
Since each async call exits as soon as `I == E || EC`, this block can be replaced with just `ThreadPool.wait()`, and there's no need to maintain a separate condition variable. (ThreadPool maintains one internally for this purpose.)
It also looks like the decrements of NumActiveWorkers and the outer loop are interleaved in a way that adds some complexity to the situation; this would remove the need for NumActiveWorkers, which clears that up too.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114845/new/

https://reviews.llvm.org/D114845



More information about the llvm-commits mailing list