[PATCH] D78856: [Support] Simplify and optimize ThreadPool

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 24 23:12:20 PDT 2020


MaskRay added a comment.

In D78856#2003373 <https://reviews.llvm.org/D78856#2003373>, @mehdi_amini wrote:

> Isn't this technically pessimizing some cases by sharing a lock (and so increasing potential contention here)?


No. Only the thread(s) calling `ThreadPool::Wait()` waits on `CompletionCondition`. When it gets stuck, it will not awake spuriously. Note, before, we took locks 3 times in the loop body. Now it is 2...
I believe this version is strictly better.


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