diff options
| author | 2019-01-27 16:42:12 +0000 | |
|---|---|---|
| committer | 2019-01-27 16:42:12 +0000 | |
| commit | b773203fb58f3ef282fb69c832d8710cab5bc82d (patch) | |
| tree | e75913f147570fbd75169647b144df85b88a038c /gnu/llvm/lib/Support/Parallel.cpp | |
| parent | tweak errno in previous (diff) | |
| download | wireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.tar.xz wireguard-openbsd-b773203fb58f3ef282fb69c832d8710cab5bc82d.zip | |
Import LLVM 7.0.1 release including clang, lld and lldb.
Diffstat (limited to 'gnu/llvm/lib/Support/Parallel.cpp')
| -rw-r--r-- | gnu/llvm/lib/Support/Parallel.cpp | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/gnu/llvm/lib/Support/Parallel.cpp b/gnu/llvm/lib/Support/Parallel.cpp index 010e42916f9..1844003b9d3 100644 --- a/gnu/llvm/lib/Support/Parallel.cpp +++ b/gnu/llvm/lib/Support/Parallel.cpp @@ -9,6 +9,9 @@ #include "llvm/Support/Parallel.h" #include "llvm/Config/llvm-config.h" + +#if LLVM_ENABLE_THREADS + #include "llvm/Support/Threading.h" #include <atomic> @@ -19,7 +22,7 @@ using namespace llvm; namespace { -/// \brief An abstract class that takes closures and runs them asynchronously. +/// An abstract class that takes closures and runs them asynchronously. class Executor { public: virtual ~Executor() = default; @@ -28,19 +31,8 @@ public: static Executor *getDefaultExecutor(); }; -#if !LLVM_ENABLE_THREADS -class SyncExecutor : public Executor { -public: - virtual void add(std::function<void()> F) { F(); } -}; - -Executor *Executor::getDefaultExecutor() { - static SyncExecutor Exec; - return &Exec; -} - -#elif defined(_MSC_VER) -/// \brief An Executor that runs tasks via ConcRT. +#if defined(_MSC_VER) +/// An Executor that runs tasks via ConcRT. class ConcRTExecutor : public Executor { struct Taskish { Taskish(std::function<void()> Task) : Task(Task) {} @@ -67,7 +59,7 @@ Executor *Executor::getDefaultExecutor() { } #else -/// \brief An implementation of an Executor that runs closures on a thread pool +/// An implementation of an Executor that runs closures on a thread pool /// in filo order. class ThreadPoolExecutor : public Executor { public: @@ -127,7 +119,6 @@ Executor *Executor::getDefaultExecutor() { #endif } -#if LLVM_ENABLE_THREADS void parallel::detail::TaskGroup::spawn(std::function<void()> F) { L.inc(); Executor::getDefaultExecutor()->add([&, F] { @@ -135,4 +126,4 @@ void parallel::detail::TaskGroup::spawn(std::function<void()> F) { L.dec(); }); } -#endif +#endif // LLVM_ENABLE_THREADS |
