25#if LLVM_ENABLE_THREADS
26void DynamicThreadPoolTaskDispatcher::dispatch(std::unique_ptr<Task>
T) {
28 std::lock_guard<std::mutex> Lock(DispatchMutex);
32 std::thread([
this,
T = std::move(
T)]()
mutable {
34 std::lock_guard<std::mutex> Lock(DispatchMutex);
36 OutstandingCV.notify_all();
40void DynamicThreadPoolTaskDispatcher::shutdown() {
41 std::unique_lock<std::mutex> Lock(DispatchMutex);
43 OutstandingCV.wait(Lock, [
this]() {
return Outstanding == 0; });
static const char * DefaultDescription
void shutdown() override
Called by ExecutionSession. Waits until all tasks have completed.
void dispatch(std::unique_ptr< Task > T) override
Run the given task.
virtual ~TaskDispatcher()
This is an optimization pass for GlobalISel generic memory operations.