[PATCH] D78856: [Support] Simplify and optimize ThreadPool
Mehdi AMINI via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 24 22:40:42 PDT 2020
mehdi_amini added a comment.
Isn't this technically pessimizing some cases by sharing a lock (and so increasing potential contention here)?
================
Comment at: llvm/lib/Support/ThreadPool.cpp:57
+ std::lock_guard<std::mutex> LockGuard(QueueLock);
+ Notify = --ActiveThreads == 0;
}
----------------
Can you expand this over different variables/statements? Or at minima add explicit parentheses? I am sure the compiler parses it, but not me :)
================
Comment at: llvm/lib/Support/ThreadPool.cpp:60
// Notify task completion, in case someone waits on ThreadPool::wait()
- CompletionCondition.notify_all();
+ if (Notify)
+ CompletionCondition.notify_all();
----------------
Update the comment here
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78856/new/
https://reviews.llvm.org/D78856
More information about the llvm-commits
mailing list