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));
#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"
/// 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
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));
});
}