Changeset View
Changeset View
Standalone View
Standalone View
clang-tools-extra/clangd/index/Background.h
Show First 20 Lines • Show All 138 Lines • ▼ Show 20 Lines | void enqueueLocked(tooling::CompileCommand Cmd, | ||||
BackgroundIndexStorage *IndexStorage); | BackgroundIndexStorage *IndexStorage); | ||||
std::mutex QueueMu; | std::mutex QueueMu; | ||||
unsigned NumActiveTasks = 0; // Only idle when queue is empty *and* no tasks. | unsigned NumActiveTasks = 0; // Only idle when queue is empty *and* no tasks. | ||||
std::condition_variable QueueCV; | std::condition_variable QueueCV; | ||||
bool ShouldStop = false; | bool ShouldStop = false; | ||||
std::deque<std::pair<Task, ThreadPriority>> Queue; | std::deque<std::pair<Task, ThreadPriority>> Queue; | ||||
std::vector<std::thread> ThreadPool; // FIXME: Abstract this away. | std::vector<std::thread> ThreadPool; // FIXME: Abstract this away. | ||||
GlobalCompilationDatabase::CommandChanged::Subscription CommandsChanged; | GlobalCompilationDatabase::CommandChanged::Subscription CommandsChanged; | ||||
// For logging | |||||
std::atomic<size_t> EnqueuedTUs{0}; | |||||
ilya-biryukov: Maybe use `std::atomic` instead? | |||||
+1 for atomic jkorous: +1 for atomic | |||||
ilya-biryukovUnsubmitted Not Done ReplyInline ActionsThis change is not related to the rest of the patch. ilya-biryukov: This change is not related to the rest of the patch.
Even adding some stats makes sense, could… | |||||
std::atomic<size_t> IndexedTUs{0}; | |||||
}; | }; | ||||
} // namespace clangd | } // namespace clangd | ||||
} // namespace clang | } // namespace clang | ||||
#endif | #endif |
Maybe use std::atomic instead?