[PATCH] D18811: Fix a race condition in support library ThreadPool
Justin Lebar via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 6 14:53:03 PDT 2016
jlebar added inline comments.
================
Comment at: lib/Support/ThreadPool.cpp:79
@@ -78,3 +70,3 @@
CompletionCondition.wait(LockGuard,
[&] { return Tasks.empty() && !ActiveThreads; });
}
----------------
joker.eph wrote:
> Would just reversing the check solve the race?
>
> ```
> [&] { return !ActiveThreads && Tasks.empty(); });
> ```
>
> If not can you elaborate a little?
>
The race is that we touch Tasks here while holding only CompletionLock, while another thread in asyncImpl may touch Tasks while holding only QueueLock.
http://reviews.llvm.org/D18811
More information about the llvm-commits
mailing list