This defines the abstract base interface for a ThreadPool allowing asynchronous parallel execution on a defined number of threads.
Synopsis
Declared in <llvm/Support/ThreadPool.h>
class ThreadPoolInterface;
Description
It is possible to reuse one thread pool for different groups of tasks by grouping tasks using ThreadPoolTaskGroup. All tasks are processed using the same queue, but it is possible to wait only for a specific group of tasks to finish.
It is also possible for worker threads to submit new tasks and wait for them. Note that this may result in a deadlock in cases such as when a task (directly or indirectly) tries to wait for its own completion, or when all 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.
Member Functions
Name |
Description |
|
Destroying the pool will drain the pending tasks and wait. The current thread may participate in the execution of the pending tasks. |
|
|
|
Returns the maximum number of worker this pool can eventually grow to. |
|
Derived Classes
Name |
Description |
A non‐threaded implementation. |
|
A ThreadPool implementation using std::threads. |
Created with MrDocs