From bebca1c496cdd6d3fdd5d3290f831f331e3114b4 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Tue, 15 Dec 2015 05:53:41 +0000 Subject: Fix MSVC build with LLVM_ENABLE_THREADS=OFF Follow-up to the ThreadPool implementation. From: Mehdi Amini llvm-svn: 255621 --- llvm/lib/Support/ThreadPool.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Support/ThreadPool.cpp') diff --git a/llvm/lib/Support/ThreadPool.cpp b/llvm/lib/Support/ThreadPool.cpp index bc004dfb8a8..d4dcb2ee96d 100644 --- a/llvm/lib/Support/ThreadPool.cpp +++ b/llvm/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; } -- cgit v1.2.3