[llvm] [Support] Join threads when stopping the ThreadPoolExecutor (PR #166054)

Maurice Heumann via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 3 09:44:01 PST 2025


momo5502 wrote:

> It's not ideal, but perhaps how the threads are joined should be dependent on whether the code is being built as a DLL? That way the performance benefit I mention above would still be available for those who build LLVM statically on Windows.

Interesting idea, however, as mentioned previously, joining threads in the destructor is dangerous either way.
Maybe, at the very least, it might be possible to just expose a function that joins the threads. This can then be called manually, after llvm_shutdown has been called. Then every consumer of LLVM can decide whether they want to call that or not.

However, I'll try to fix the tests first, because there is obviously something I broke, then I'll try to create a unit test that reproduces the issue.



https://github.com/llvm/llvm-project/pull/166054


More information about the llvm-commits mailing list