summaryrefslogtreecommitdiff
path: root/lib/Support/ThreadPool.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-12-18 20:10:56 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-12-18 20:10:56 +0000
commit044eb2f6afba375a914ac9d8024f8f5142bb912e (patch)
tree1475247dc9f9fe5be155ebd4c9069c75aadf8c20 /lib/Support/ThreadPool.cpp
parenteb70dddbd77e120e5d490bd8fbe7ff3f8fa81c6b (diff)
Notes
Diffstat (limited to 'lib/Support/ThreadPool.cpp')
-rw-r--r--lib/Support/ThreadPool.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Support/ThreadPool.cpp b/lib/Support/ThreadPool.cpp
index 22b7550d4971..d0212ca13467 100644
--- a/lib/Support/ThreadPool.cpp
+++ b/lib/Support/ThreadPool.cpp
@@ -14,14 +14,15 @@
#include "llvm/Support/ThreadPool.h"
#include "llvm/Config/llvm-config.h"
+#include "llvm/Support/Threading.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
#if LLVM_ENABLE_THREADS
-// Default to std::thread::hardware_concurrency
-ThreadPool::ThreadPool() : ThreadPool(std::thread::hardware_concurrency()) {}
+// Default to hardware_concurrency
+ThreadPool::ThreadPool() : ThreadPool(hardware_concurrency()) {}
ThreadPool::ThreadPool(unsigned ThreadCount)
: ActiveThreads(0), EnableFlag(true) {
@@ -46,8 +47,8 @@ ThreadPool::ThreadPool(unsigned ThreadCount)
// in order for wait() to properly detect that even if the queue is
// empty, there is still a task in flight.
{
- ++ActiveThreads;
std::unique_lock<std::mutex> LockGuard(CompletionLock);
+ ++ActiveThreads;
}
Task = std::move(Tasks.front());
Tasks.pop();