[Support] Fix locking of shared variable in threadpool

llvm-svn: 319027
diff --git a/llvm/lib/Support/ThreadPool.cpp b/llvm/lib/Support/ThreadPool.cpp
index f1b5bdf..d0212ca 100644
--- a/llvm/lib/Support/ThreadPool.cpp
+++ b/llvm/lib/Support/ThreadPool.cpp
@@ -47,8 +47,8 @@
           // 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();