diff --git a/clang-tools-extra/clangd/support/Threading.h b/clang-tools-extra/clangd/support/Threading.h --- a/clang-tools-extra/clangd/support/Threading.h +++ b/clang-tools-extra/clangd/support/Threading.h @@ -110,12 +110,13 @@ void wait() const { (void)wait(Deadline::infinity()); } LLVM_NODISCARD bool wait(Deadline D) const; // The name is used for tracing and debugging (e.g. to name a spawned thread). - void runAsync(const llvm::Twine &Name, llvm::unique_function Action); + void runAsync(const llvm::Twine &Name, + llvm::unique_function Action) const; private: mutable std::mutex Mutex; mutable std::condition_variable TasksReachedZero; - std::size_t InFlightTasks = 0; + mutable std::size_t InFlightTasks = 0; }; /// Runs \p Action asynchronously with a new std::thread. The context will be diff --git a/clang-tools-extra/clangd/support/Threading.cpp b/clang-tools-extra/clangd/support/Threading.cpp --- a/clang-tools-extra/clangd/support/Threading.cpp +++ b/clang-tools-extra/clangd/support/Threading.cpp @@ -70,7 +70,7 @@ } void AsyncTaskRunner::runAsync(const llvm::Twine &Name, - llvm::unique_function Action) { + llvm::unique_function Action) const { { std::lock_guard Lock(Mutex); ++InFlightTasks;