[Mlir-commits] [llvm] [mlir] Split the llvm::ThreadPool into an abstract base class and an impleme… (PR #82094)
Alexandre Ganea
llvmlistbot at llvm.org
Tue Feb 20 04:07:10 PST 2024
================
@@ -49,16 +46,31 @@ class ThreadPoolTaskGroup;
/// available threads are used up by tasks waiting for a task that has no thread
/// left to run on (this includes waiting on the returned future). It should be
/// generally safe to wait() for a group as long as groups do not form a cycle.
-class ThreadPool {
+class ThreadPoolInterface {
+ // The actual method to enqueue a task to be defined by the concrete
+ // implementation.
+ virtual void asyncEnqueue(std::function<void()> Task,
+ ThreadPoolTaskGroup *Group) = 0;
+
public:
- /// Construct a pool using the hardware strategy \p S for mapping hardware
- /// execution resources (threads, cores, CPUs)
- /// Defaults to using the maximum execution resources in the system, but
- /// accounting for the affinity mask.
- ThreadPool(ThreadPoolStrategy S = hardware_concurrency());
+ // Destroying the pool will drain the pending tasks and wait. The current
----------------
aganea wrote:
Same here?
https://github.com/llvm/llvm-project/pull/82094
More information about the Mlir-commits
mailing list