[Lldb-commits] [lldb] [lldb][progress] Add progress manager class (PR #81319)
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Fri Feb 9 14:49:04 PST 2024
================
@@ -66,3 +66,47 @@ void Progress::ReportProgress() {
m_debugger_id);
}
}
+
+void ProgressManager::Initialize() {
+ lldbassert(!InstanceImpl() && "A progress report manager already exists.");
+ InstanceImpl().emplace();
+}
+
+void ProgressManager::Terminate() {
+ lldbassert(InstanceImpl() &&
+ "A progress report manager has already been terminated.");
+ InstanceImpl().reset();
+}
+
+std::optional<ProgressManager> &ProgressManager::InstanceImpl() {
+ static std::optional<ProgressManager> g_progress_manager;
+ return g_progress_manager;
----------------
clayborg wrote:
The global destructor chain will still cause this to be destroyed when the main thread exits. Which is ok if we return `std::optional<ProgressManager>` from `ProgressManager::Instance()`. More below in `ProgressManager &ProgressManager::Instance()` comments.
https://github.com/llvm/llvm-project/pull/81319
More information about the lldb-commits
mailing list