[clang-tools-extra] r370864 - [clangd] Move threading helper to more appropriate header. NFC
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 4 02:53:24 PDT 2019
Author: sammccall
Date: Wed Sep 4 02:53:24 2019
New Revision: 370864
URL: http://llvm.org/viewvc/llvm-project?rev=370864&view=rev
Log:
[clangd] Move threading helper to more appropriate header. NFC
Modified:
clang-tools-extra/trunk/clangd/CodeComplete.cpp
clang-tools-extra/trunk/clangd/TUScheduler.h
clang-tools-extra/trunk/clangd/Threading.h
Modified: clang-tools-extra/trunk/clangd/CodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/CodeComplete.cpp?rev=370864&r1=370863&r2=370864&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/CodeComplete.cpp (original)
+++ clang-tools-extra/trunk/clangd/CodeComplete.cpp Wed Sep 4 02:53:24 2019
@@ -31,7 +31,7 @@
#include "Protocol.h"
#include "Quality.h"
#include "SourceCode.h"
-#include "TUScheduler.h"
+#include "Threading.h"
#include "Trace.h"
#include "URI.h"
#include "index/Index.h"
Modified: clang-tools-extra/trunk/clangd/TUScheduler.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/TUScheduler.h?rev=370864&r1=370863&r2=370864&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/TUScheduler.h (original)
+++ clang-tools-extra/trunk/clangd/TUScheduler.h Wed Sep 4 02:53:24 2019
@@ -20,7 +20,6 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
-#include <future>
namespace clang {
namespace clangd {
@@ -259,19 +258,6 @@ private:
std::chrono::steady_clock::duration UpdateDebounce;
};
-/// Runs \p Action asynchronously with a new std::thread. The context will be
-/// propagated.
-template <typename T>
-std::future<T> runAsync(llvm::unique_function<T()> Action) {
- return std::async(
- std::launch::async,
- [](llvm::unique_function<T()> &&Action, Context Ctx) {
- WithContext WithCtx(std::move(Ctx));
- return Action();
- },
- std::move(Action), Context::current().clone());
-}
-
} // namespace clangd
} // namespace clang
Modified: clang-tools-extra/trunk/clangd/Threading.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/Threading.h?rev=370864&r1=370863&r2=370864&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/Threading.h (original)
+++ clang-tools-extra/trunk/clangd/Threading.h Wed Sep 4 02:53:24 2019
@@ -14,6 +14,7 @@
#include "llvm/ADT/Twine.h"
#include <cassert>
#include <condition_variable>
+#include <future>
#include <memory>
#include <mutex>
#include <thread>
@@ -117,6 +118,19 @@ private:
std::size_t InFlightTasks = 0;
};
+/// Runs \p Action asynchronously with a new std::thread. The context will be
+/// propagated.
+template <typename T>
+std::future<T> runAsync(llvm::unique_function<T()> Action) {
+ return std::async(
+ std::launch::async,
+ [](llvm::unique_function<T()> &&Action, Context Ctx) {
+ WithContext WithCtx(std::move(Ctx));
+ return Action();
+ },
+ std::move(Action), Context::current().clone());
+}
+
} // namespace clangd
} // namespace clang
#endif
More information about the cfe-commits
mailing list