summaryrefslogtreecommitdiff
path: root/ELF/Threads.h
diff options
context:
space:
mode:
Diffstat (limited to 'ELF/Threads.h')
-rw-r--r--ELF/Threads.h21
1 files changed, 9 insertions, 12 deletions
diff --git a/ELF/Threads.h b/ELF/Threads.h
index 897432e69f8e7..e01afd4d3fc90 100644
--- a/ELF/Threads.h
+++ b/ELF/Threads.h
@@ -61,8 +61,7 @@
#include "Config.h"
-#include "lld/Core/Parallel.h"
-#include <algorithm>
+#include "llvm/Support/Parallel.h"
#include <functional>
namespace lld {
@@ -71,19 +70,17 @@ namespace elf {
template <class IterTy, class FuncTy>
void parallelForEach(IterTy Begin, IterTy End, FuncTy Fn) {
if (Config->Threads)
- parallel_for_each(Begin, End, Fn);
+ for_each(llvm::parallel::par, Begin, End, Fn);
else
- std::for_each(Begin, End, Fn);
+ for_each(llvm::parallel::seq, Begin, End, Fn);
}
-inline void parallelFor(size_t Begin, size_t End,
- std::function<void(size_t)> Fn) {
- if (Config->Threads) {
- parallel_for(Begin, End, Fn);
- } else {
- for (size_t I = Begin; I < End; ++I)
- Fn(I);
- }
+inline void parallelForEachN(size_t Begin, size_t End,
+ std::function<void(size_t)> Fn) {
+ if (Config->Threads)
+ for_each_n(llvm::parallel::par, Begin, End, Fn);
+ else
+ for_each_n(llvm::parallel::seq, Begin, End, Fn);
}
}
}