[Lldb-commits] [lldb] SBDebugger: Add new APIs `AddDestroyCallback` and `RemoveDestroyCallback` (PR #89868)

via lldb-commits lldb-commits at lists.llvm.org
Mon May 13 09:23:39 PDT 2024


================
@@ -731,8 +747,11 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
   lldb::TargetSP m_dummy_target_sp;
   Diagnostics::CallbackID m_diagnostics_callback_id;
 
-  lldb_private::DebuggerDestroyCallback m_destroy_callback = nullptr;
-  void *m_destroy_callback_baton = nullptr;
+  std::recursive_mutex m_destroy_callback_mutex;
----------------
royitaqi wrote:

Recursive is necessary. This is because HandleDestroyCallbacks will invoke callbacks, which can call Add/RemoveDestoryCallback. All three functions use the same mutex, so it has to be recursive.

See more: https://github.com/llvm/llvm-project/pull/89868#discussion_r1588099079

https://github.com/llvm/llvm-project/pull/89868


More information about the lldb-commits mailing list