[PATCH] D123225: [ThreadPool] add ability to group tasks into separate groups

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 18 21:46:14 PDT 2022


MaskRay added inline comments.


================
Comment at: llvm/include/llvm/Support/ThreadPool.h:73
+  template <typename Function, typename... Args>
+  inline auto async(ThreadPoolTaskGroup &Group, Function &&F,
+                    Args &&...ArgList) {
----------------
The `inline` keyword can be removed.


================
Comment at: llvm/lib/Support/ThreadPool.cpp:73
+        return;
+      if (WaitingForGroup != nullptr && workCompletedUnlocked(WaitingForGroup))
+        return;
----------------
`workCompletedUnlocked(WaitingForGroup)` is slow when WaitingForGroup is not null. You may check the inverse of other conditions or cache the result of `workCompletedUnlocked(WaitingForGroup)`


================
Comment at: llvm/unittests/Support/ThreadPool.cpp:327
+             std::chrono::milliseconds(10))
+        ;
+    });
----------------
What does this do? Use std::this_thread::sleep_for?


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

https://reviews.llvm.org/D123225



More information about the llvm-commits mailing list