[PATCH] D102684: [LLD] Allow disabling the early exit codepath as a build configuration

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 20 10:05:14 PDT 2021


rnk added a comment.

I'd be OK with this option, but I think it makes more sense to try to disable the thread pool destructor in the support library. Oh, it looks like that has already been done:
https://github.com/llvm/llvm-project/blob/main/llvm/lib/Support/Parallel.cpp#L121

Why isn't that working? I guess the reason it's not working is that the unique_ptr destructor destroys the ThreadPoolExecutor when the LLVM DLL is unloaded, even during _exit:

  static std::unique_ptr<ThreadPoolExecutor> Exec(&(*ManagedExec));

So, here is my (possibly terribe) idea: let's just leak the thread pool executor. It really can't be destroyed until the user calls llvm_shutdown to cancel/join the threads. This code would do it, right?

  static ThreadPoolExecutor *Exec = &(*ManagedExec);


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102684/new/

https://reviews.llvm.org/D102684



More information about the llvm-commits mailing list