NumThreads = 1;
NumThreads = std::min<unsigned>(NumThreads, DebugMapPtrsOrErr->size());
- llvm::ThreadPool Threads(NumThreads);
// 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 (NumThreads == 1) {
LinkLambda();
- else
+ } else {
+ llvm::ThreadPool Threads(NumThreads);
Threads.async(LinkLambda);
+ Threads.wait();
+ }
if (NeedsTempFiles)
TempFiles.emplace_back(Map->getTriple().getArchName().str(),
OutputFile);
}
- Threads.wait();
if (NeedsTempFiles &&
!MachOUtils::generateUniversalBinary(