LLVM 22.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. | |
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. | |
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 215 of file ThreadPool.h.
SingleThreadExecutor::SingleThreadExecutor | ( | ThreadPoolStrategy | ignored = {} | ) |
Construct a non-threaded pool, ignoring using the hardware strategy.
Definition at line 192 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 219 of file ThreadPool.cpp.
References wait().
|
inlineoverridevirtual |
Returns always 1: there is no concurrency.
Implements llvm::ThreadPoolInterface.
Definition at line 230 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 215 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 200 of file ThreadPool.cpp.
Referenced by llvm::gsym::DwarfTransformer::convert(), llvm::dwarf_linker::classic::DWARFLinker::link(), llvm::dwarf_linker::parallel::DWARFLinkerImpl::link(), splitCodeGen(), wait(), and ~SingleThreadExecutor().
|
overridevirtual |
Blocking wait for only all the tasks in the given group to complete.
Implements llvm::ThreadPoolInterface.
Definition at line 209 of file ThreadPool.cpp.
References wait().