#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
-#include <future>
namespace clang {
namespace clangd {
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
#include "llvm/ADT/Twine.h"
#include <cassert>
#include <condition_variable>
+#include <future>
#include <memory>
#include <mutex>
#include <thread>
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