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

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Thu May 2 09:21:24 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;
----------------
JDevlieghere wrote:

Does this actually **need** to be thread safe? APIs being thread safe is of course a good thing, but in its current state, there are plenty of methods in the Debugger class that are not guaranteed to be thread safe. Unless there's a need for this to be safe, I wouldn't bother with the new mutex... 

Either way this shouldn't be a _recursive_ mutex.

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


More information about the lldb-commits mailing list