From: Mehdi Amini Date: Tue, 15 Dec 2015 05:53:41 +0000 (+0000) Subject: Fix MSVC build with LLVM_ENABLE_THREADS=OFF X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=d99f1b2161305f15e2ee6c1de1e397d53609c72e Fix MSVC build with LLVM_ENABLE_THREADS=OFF Follow-up to the ThreadPool implementation. From: Mehdi Amini git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255621 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Support/ThreadPool.cpp b/lib/Support/ThreadPool.cpp index bc004dfb8a8..d4dcb2ee96d 100644 --- a/lib/Support/ThreadPool.cpp +++ b/lib/Support/ThreadPool.cpp @@ -125,16 +125,25 @@ void ThreadPool::wait() { while (!Tasks.empty()) { auto Task = std::move(Tasks.front()); Tasks.pop(); - Task(); +#ifndef _MSC_VER + Task(); +#else + Task(/* unused */ false); +#endif } } std::shared_future ThreadPool::asyncImpl(TaskTy Task) { +#ifndef _MSC_VER // Get a Future with launch::deferred execution using std::async auto Future = std::async(std::launch::deferred, std::move(Task)).share(); // Wrap the future so that both ThreadPool::wait() can operate and the // returned future can be sync'ed on. PackagedTaskTy PackagedTask([Future]() { Future.get(); }); +#else + auto Future = std::async(std::launch::deferred, std::move(Task), false).share(); + PackagedTaskTy PackagedTask([Future](bool) -> bool { Future.get(); return false; }); +#endif Tasks.push(std::move(PackagedTask)); return Future; }