[Lldb-commits] [lldb] [llvm] [mlir] Split the llvm::ThreadPool into an abstract base class and an implementation (PR #82094)

Mehdi Amini via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 28 15:18:58 PST 2024


================
@@ -209,25 +231,66 @@ class ThreadPool {
   /// Number of threads active for tasks in the given group (only non-zero).
   DenseMap<ThreadPoolTaskGroup *, unsigned> ActiveGroups;
 
-#if LLVM_ENABLE_THREADS // avoids warning for unused variable
   /// Signal for the destruction of the pool, asking thread to exit.
   bool EnableFlag = true;
-#endif
 
   const ThreadPoolStrategy Strategy;
 
   /// Maximum number of threads to potentially grow this pool to.
   const unsigned MaxThreadCount;
 };
 
+/// A non-threaded implementation.
+class SingleThreadExecutor : public ThreadPoolInterface {
----------------
joker-eph wrote:

I was trying to use as little as possible so that the code is always at least "parsed" and we are less likely to break it (and also my IDE does not gray this entirely as a comment because of the macro).

But this is a weak argument, happy to restore a big `#if LLVM_ENABLE_THREADS` `#else` around the two classes.

https://github.com/llvm/llvm-project/pull/82094


More information about the lldb-commits mailing list