[PATCH] D18811: Fix a race condition in support library ThreadPool

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 6 14:52:34 PDT 2016


joker.eph added inline comments.

================
Comment at: lib/Support/ThreadPool.cpp:65
@@ -64,3 +56,3 @@
-          std::unique_lock<std::mutex> LockGuard(CompletionLock);
+          std::unique_lock<std::mutex> LockGuard(Mutex);
           --ActiveThreads;
         }
----------------
To answer the comment about why `ActiveThreads` was atomic: it is updated here guarded by `CompletionLock`, but was incremented a few lines above guarded by `QueueLock`.


http://reviews.llvm.org/D18811





More information about the llvm-commits mailing list