diff options
-rw-r--r-- | lld/Common/ErrorHandler.cpp | 1 | ||||
-rw-r--r-- | lld/Common/Threads.cpp | 20 | ||||
-rw-r--r-- | lld/ELF/Driver.cpp | 1 | ||||
-rw-r--r-- | lld/include/lld/Common/Threads.h | 3 |
4 files changed, 0 insertions, 25 deletions
diff --git a/lld/Common/ErrorHandler.cpp b/lld/Common/ErrorHandler.cpp index 522174cc7b0..52f40c5cf38 100644 --- a/lld/Common/ErrorHandler.cpp +++ b/lld/Common/ErrorHandler.cpp @@ -46,7 +46,6 @@ ErrorHandler &lld::errorHandler() { } void lld::exitLld(int Val) { - waitForBackgroundThreads(); // Dealloc/destroy ManagedStatic variables before calling // _exit(). In a non-LTO build, this is a nop. In an LTO // build allows us to get the output of -time-passes. diff --git a/lld/Common/Threads.cpp b/lld/Common/Threads.cpp index 2667683a1c8..c64b8c38b90 100644 --- a/lld/Common/Threads.cpp +++ b/lld/Common/Threads.cpp @@ -8,25 +8,5 @@ //===----------------------------------------------------------------------===// #include "lld/Common/Threads.h" -#include <thread> -#include <vector> - -static std::vector<std::thread> Threads; bool lld::ThreadsEnabled = true; - -// Runs a given function in a new thread. -void lld::runBackground(std::function<void()> Fn) { - Threads.emplace_back(Fn); -} - -// Wait for all threads spawned for runBackground() to finish. -// -// You need to call this function from the main thread before exiting -// because it is not defined what will happen to non-main threads when -// the main thread exits. -void lld::waitForBackgroundThreads() { - for (std::thread &T : Threads) - if (T.joinable()) - T.join(); -} diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 16d593bbac6..a2e4559bab3 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -93,7 +93,6 @@ bool elf::link(ArrayRef<const char *> Args, bool CanExitEarly, Config->Argv = {Args.begin(), Args.end()}; Driver->main(Args, CanExitEarly); - waitForBackgroundThreads(); // Exit immediately if we don't need to return to the caller. // This saves time because the overhead of calling destructors diff --git a/lld/include/lld/Common/Threads.h b/lld/include/lld/Common/Threads.h index 981946723bc..85459075314 100644 --- a/lld/include/lld/Common/Threads.h +++ b/lld/include/lld/Common/Threads.h @@ -81,9 +81,6 @@ inline void parallelForEachN(size_t Begin, size_t End, for_each_n(llvm::parallel::seq, Begin, End, Fn); } -void runBackground(std::function<void()> Fn); -void waitForBackgroundThreads(); - } // namespace lld #endif |