[llvm] [LLD] Avoid non-deterministic relocations processing. (PR #107186)
Andrew Ng via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 5 06:40:55 PDT 2024
================
@@ -113,7 +113,7 @@ class ThreadPoolExecutor : public Executor {
private:
bool hasSequentialTasks() const {
- return !WorkQueueSequential.empty() && !SequentialQueueIsLocked;
+ return !WorkQueueSequential.empty() && (getThreadIndex() == 0);
----------------
nga888 wrote:
IIUC, this change makes `hasSequentialTasks()` dependent on the thread index and `hasSequentialTasks()` is used as part of the `Cond.wait()` predicate in the worker thread main loop in `work()`. The `add()` method calls `Cond.notify_one()` to "wake" a single waiting worker thread. If the only outstanding task is sequential and the thread that is woken is not thread 0, then couldn't this possibly lead to the task never being executed? I think in practise because of "spurious wakeups", this would not happen but can that be guaranteed?
https://github.com/llvm/llvm-project/pull/107186
More information about the llvm-commits
mailing list