1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

[Orc] Roll back ThreadPool to std::function

MSVC doesn't allow move-only types in std::packaged_task. Boo.

llvm-svn: 371844
This commit is contained in:
Benjamin Kramer 2019-09-13 11:59:51 +00:00
parent d97df4c6c8
commit 99cfb3923c
3 changed files with 7 additions and 4 deletions

View File

@ -114,7 +114,9 @@ private:
this->ES->setDispatchMaterialization(
[this](JITDylib &JD, std::unique_ptr<MaterializationUnit> MU) {
auto Work = [MU = std::move(MU), &JD] { MU->doMaterialize(JD); };
// FIXME: Switch to move capture once we have C++14.
auto SharedMU = std::shared_ptr<MaterializationUnit>(std::move(MU));
auto Work = [SharedMU, &JD]() { SharedMU->doMaterialize(JD); };
CompileThreads.async(std::move(Work));
});
ExitOnErr(S.addSpeculationRuntime(this->ES->getMainJITDylib(), Mangle));

View File

@ -13,7 +13,6 @@
#ifndef LLVM_SUPPORT_THREAD_POOL_H
#define LLVM_SUPPORT_THREAD_POOL_H
#include "llvm/ADT/FunctionExtras.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/thread.h"
@ -36,7 +35,7 @@ namespace llvm {
/// for some work to become available.
class ThreadPool {
public:
using TaskTy = unique_function<void()>;
using TaskTy = std::function<void()>;
using PackagedTaskTy = std::packaged_task<void()>;
/// Construct a pool with the number of threads found by

View File

@ -132,7 +132,9 @@ LLJIT::LLJIT(LLJITBuilderState &S, Error &Err)
CompileThreads = std::make_unique<ThreadPool>(S.NumCompileThreads);
ES->setDispatchMaterialization(
[this](JITDylib &JD, std::unique_ptr<MaterializationUnit> MU) {
auto Work = [MU = std::move(MU), &JD] { MU->doMaterialize(JD); };
// FIXME: Switch to move capture once we have c++14.
auto SharedMU = std::shared_ptr<MaterializationUnit>(std::move(MU));
auto Work = [SharedMU, &JD]() { SharedMU->doMaterialize(JD); };
CompileThreads->async(std::move(Work));
});
}