Index: lib/Support/Parallel.cpp =================================================================== --- lib/Support/Parallel.cpp +++ lib/Support/Parallel.cpp @@ -12,6 +12,7 @@ #if LLVM_ENABLE_THREADS +#include "llvm/Support/ManagedStatic.h" #include "llvm/Support/Threading.h" #include @@ -28,7 +29,7 @@ virtual ~Executor() = default; virtual void add(std::function func) = 0; - static Executor *getDefaultExecutor(); + static Executor &getDefaultExecutor(); }; #if defined(_MSC_VER) @@ -53,9 +54,9 @@ } }; -Executor *Executor::getDefaultExecutor() { - static ConcRTExecutor exec; - return &exec; +Executor &Executor::getDefaultExecutor() { + static llvm::ManagedStatic exec; + return *exec; } #else @@ -112,16 +113,16 @@ parallel::detail::Latch Done; }; -Executor *Executor::getDefaultExecutor() { - static ThreadPoolExecutor exec; - return &exec; +Executor &Executor::getDefaultExecutor() { + static llvm::ManagedStatic exec; + return *exec; } #endif } void parallel::detail::TaskGroup::spawn(std::function F) { L.inc(); - Executor::getDefaultExecutor()->add([&, F] { + Executor::getDefaultExecutor().add([&, F] { F(); L.dec(); });