diff options
Diffstat (limited to 'include/lld/Core/Parallel.h')
-rw-r--r-- | include/lld/Core/Parallel.h | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/include/lld/Core/Parallel.h b/include/lld/Core/Parallel.h index e2c38308b768..2dde97d9e3f0 100644 --- a/include/lld/Core/Parallel.h +++ b/include/lld/Core/Parallel.h @@ -12,7 +12,6 @@ #include "lld/Core/Instrumentation.h" #include "lld/Core/LLVM.h" -#include "lld/Core/range.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/thread.h" @@ -63,41 +62,6 @@ public: } }; -/// \brief An implementation of future. std::future and std::promise in -/// old libstdc++ have a threading bug; there is a small chance that a -/// call of future::get throws an exception in the normal use case. -/// We want to use our own future implementation until we drop support -/// of old versions of libstdc++. -/// https://gcc.gnu.org/ml/gcc-patches/2014-05/msg01389.html -template<typename T> class Future { -public: - Future() : _hasValue(false) {} - - void set(T &&val) { - assert(!_hasValue); - { - std::unique_lock<std::mutex> lock(_mutex); - _val = val; - _hasValue = true; - } - _cond.notify_all(); - } - - T &get() { - std::unique_lock<std::mutex> lock(_mutex); - if (_hasValue) - return _val; - _cond.wait(lock, [&] { return _hasValue; }); - return _val; - } - -private: - T _val; - bool _hasValue; - std::mutex _mutex; - std::condition_variable _cond; -}; - // Classes in this namespace are implementation details of this header. namespace internal { |