[Lldb-commits] [lldb] [lldb] Wrap Target::GetAPIMutex() into a Lockable handle (NFC) (PR #212872)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 6 21:12:43 PDT 2026


================
@@ -110,7 +110,8 @@ lldb::addr_t SBAddress::GetLoadAddress(const SBTarget &target) const {
   TargetSP target_sp(target.GetSP());
   if (target_sp) {
     if (m_opaque_up->IsValid()) {
-      std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
+      TargetAPILock guard(target_sp->GetAPIMutex());
+      guard.lock();
----------------
JDevlieghere wrote:

If this is meant to be a RAII object, why the lock? Why doesn't it lock in the ctor? But it unlocks in the dtor?

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


More information about the lldb-commits mailing list