From: Jan Korous Date: Mon, 27 Nov 2017 13:42:03 +0000 (+0000) Subject: [Support] Fix locking of shared variable in threadpool X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c9555a244e4aeea5f434856a18899f6e7980852;p=llvm [Support] Fix locking of shared variable in threadpool git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319027 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Support/ThreadPool.cpp b/lib/Support/ThreadPool.cpp index f1b5bdf40c3..d0212ca1346 100644 --- a/lib/Support/ThreadPool.cpp +++ b/lib/Support/ThreadPool.cpp @@ -47,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 LockGuard(CompletionLock); + ++ActiveThreads; } Task = std::move(Tasks.front()); Tasks.pop();