if (NumThreads == 0)
Options.Threads = llvm::thread::hardware_concurrency();
+ else
+ Options.Threads = NumThreads;
if (DumpDebugMap || Verbose)
Options.Threads = 1;
// Shared a single binary holder for all the link steps.
BinaryHolder BinHolder;
- NumThreads =
+ unsigned ThreadCount =
std::min<unsigned>(OptionsOrErr->Threads, DebugMapPtrsOrErr->size());
- llvm::ThreadPool Threads(NumThreads);
+ llvm::ThreadPool Threads(ThreadCount);
// If there is more than one link to execute, we need to generate
// temporary files.
// FIXME: The DwarfLinker can have some very deep recursion that can max
// out the (significantly smaller) stack when using threads. We don't
// want this limitation when we only have a single thread.
- if (NumThreads == 1)
+ if (ThreadCount == 1)
LinkLambda(OS);
else
Threads.async(LinkLambda, OS);