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

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 25 11:08:28 PDT 2020


aganea added inline comments.


================
Comment at: llvm/lib/Support/ThreadPool.cpp:57
+          std::lock_guard<std::mutex> LockGuard(QueueLock);
+          Notify = --ActiveThreads == 0 && Tasks.empty();
         }
----------------
MaskRay wrote:
> aganea wrote:
> > Is it worth generalizing the notify condition between this and `ThreadPool::wait()` below, to ease future maintenance/comprehension?
> > Is it worth generalizing the notify condition between this and ThreadPool::wait() below, to ease future maintenance/comprehension?
> 
> Sorry that I am not following this suggestion. Can you elaborate?
I meant a function, to be used by the code here and the code below in `wait()`, simply to signify (to users who read the code) that it should check exactly the same things?
```
private: bool workCompletedNoLock() { return !ActiveThreads && Tasks.empty(); }
```



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