LLVM 20.0.0git
|
A non-threaded implementation. More...
#include "llvm/Support/ThreadPool.h"
Public Member Functions | |
SingleThreadExecutor (ThreadPoolStrategy ignored={}) | |
Construct a non-threaded pool, ignoring using the hardware strategy. | |
~SingleThreadExecutor () override | |
Blocking destructor: the pool will first execute the pending tasks. | |
void | wait () override |
Blocking wait for all the tasks to execute first. | |
void | wait (ThreadPoolTaskGroup &Group) override |
Blocking wait for only all the tasks in the given group to complete. | |
unsigned | getMaxConcurrency () const override |
Returns always 1: there is no concurrency. | |
unsigned | getThreadCount () const |
bool | isWorkerThread () const |
Returns true if the current thread is a worker thread of this thread pool. | |
Public Member Functions inherited from llvm::ThreadPoolInterface | |
virtual | ~ThreadPoolInterface () |
Destroying the pool will drain the pending tasks and wait. | |
virtual void | wait ()=0 |
Blocking wait for all the threads to complete and the queue to be empty. | |
virtual void | wait (ThreadPoolTaskGroup &Group)=0 |
Blocking wait for only all the threads in the given group to complete. | |
virtual unsigned | getMaxConcurrency () const =0 |
Returns the maximum number of worker this pool can eventually grow to. | |
template<typename Function , typename... Args> | |
auto | async (Function &&F, Args &&...ArgList) |
Asynchronous submission of a task to the pool. | |
template<typename Function , typename... Args> | |
auto | async (ThreadPoolTaskGroup &Group, Function &&F, Args &&...ArgList) |
Overload, task will be in the given task group. | |
template<typename Func > | |
auto | async (Func &&F) -> std::shared_future< decltype(F())> |
Asynchronous submission of a task to the pool. | |
template<typename Func > | |
auto | async (ThreadPoolTaskGroup &Group, Func &&F) -> std::shared_future< decltype(F())> |
A non-threaded implementation.
Definition at line 218 of file ThreadPool.h.
SingleThreadExecutor::SingleThreadExecutor | ( | ThreadPoolStrategy | ignored = {} | ) |
Construct a non-threaded pool, ignoring using the hardware strategy.
Definition at line 193 of file ThreadPool.cpp.
References llvm::ThreadPoolStrategy::compute_thread_count(), llvm::errs(), and ThreadCount.
|
override |
Blocking destructor: the pool will first execute the pending tasks.
Definition at line 220 of file ThreadPool.cpp.
References wait().
|
inlineoverridevirtual |
Returns always 1: there is no concurrency.
Implements llvm::ThreadPoolInterface.
Definition at line 233 of file ThreadPool.h.
Referenced by llvm::lto::ThinBackendProc::getThreadCount().
|
inline |
Definition at line 237 of file ThreadPool.h.
bool SingleThreadExecutor::isWorkerThread | ( | ) | const |
Returns true if the current thread is a worker thread of this thread pool.
Definition at line 216 of file ThreadPool.cpp.
References llvm::report_fatal_error().
|
overridevirtual |
Blocking wait for all the tasks to execute first.
Implements llvm::ThreadPoolInterface.
Definition at line 201 of file ThreadPool.cpp.
Referenced by llvm::gsym::DwarfTransformer::convert(), llvm::dwarf_linker::classic::DWARFLinker::link(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::link(), splitCodeGen(), llvm::lto::ThinBackendProc::wait(), wait(), and ~SingleThreadExecutor().
|
overridevirtual |
Blocking wait for only all the tasks in the given group to complete.
Implements llvm::ThreadPoolInterface.
Definition at line 210 of file ThreadPool.cpp.
References wait().