[lld] r248193 - COFF: Do not call std::async with std::launch::async if multithreading is disabled.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 21 12:12:37 PDT 2015
Author: ruiu
Date: Mon Sep 21 14:12:36 2015
New Revision: 248193
URL: http://llvm.org/viewvc/llvm-project?rev=248193&view=rev
Log:
COFF: Do not call std::async with std::launch::async if multithreading is disabled.
Modified:
lld/trunk/COFF/SymbolTable.cpp
Modified: lld/trunk/COFF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/SymbolTable.cpp?rev=248193&r1=248192&r2=248193&view=diff
==============================================================================
--- lld/trunk/COFF/SymbolTable.cpp (original)
+++ lld/trunk/COFF/SymbolTable.cpp Mon Sep 21 14:12:36 2015
@@ -24,15 +24,21 @@ namespace lld {
namespace coff {
void SymbolTable::addFile(std::unique_ptr<InputFile> FileP) {
+#if LLVM_ENABLE_THREADS
+ std::launch Policy = std::launch::async;
+#else
+ std::launch Policy = std::launch::deferred;
+#endif
+
InputFile *File = FileP.get();
Files.push_back(std::move(FileP));
if (auto *F = dyn_cast<ArchiveFile>(File)) {
ArchiveQueue.push_back(
- std::async(std::launch::async, [=]() { F->parse(); return F; }));
+ std::async(Policy, [=]() { F->parse(); return F; }));
return;
}
ObjectQueue.push_back(
- std::async(std::launch::async, [=]() { File->parse(); return File; }));
+ std::async(Policy, [=]() { File->parse(); return File; }));
if (auto *F = dyn_cast<ObjectFile>(File)) {
ObjectFiles.push_back(F);
} else if (auto *F = dyn_cast<BitcodeFile>(File)) {
More information about the llvm-commits
mailing list