[llvm] [Support] Join threads when stopping the ThreadPoolExecutor (PR #166054)
Andrew Ng via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 8 06:58:09 PST 2026
nga888 wrote:
> Hey, @nga888, what's the state here? From my side, everything seems done. Is the code fine for you, or is there something you want changed?
Sorry, I've been busy with release work and then the holidays.
I've done some brief experiments with the LLD lit testing and there doesn't appear to be a significant overhead on Windows, although I'm "limited" to a PC with 16C/32T. LLD ELF already clamps to 16 threads by default, but I don't think this applies to the other flavours of LLD.
Looking at the code again, I think perhaps the `Threads.clear()` could possibly be removed from `stop()` as I don't think this is essential, although probably doesn't make a big difference either. Could you give it a try for your test case?
The other thing that would need updating is the comment in `Executor::getDefaultExecutor()`. Perhaps something like:
```
// The ManagedStatic enables the ThreadPoolExecutor to be stopped via
// llvm_shutdown() on Windows. This is important to avoid various race
// conditions at process exit that can cause crashes or deadlocks.
```
https://github.com/llvm/llvm-project/pull/166054
More information about the llvm-commits
mailing list