================
@@ -1692,6 +1692,20 @@ class Target : public
std::enable_shared_from_this<Target>,
}
};
+/// The private implementation backing SBLock.
+struct APILock {
+ APILock(std::recursive_mutex &mutex) : lock(mutex) {}
+ std::lock_guard<std::recursive_mutex> lock;
+};
+
+/// The private implementation used by SBLock to hand out the target API mutex.
+/// It has a TargetSP to ensure the lock cannot outlive the target.
+struct TargetAPILock : public APILock {
----------------
JDevlieghere wrote:
This doesn't quite work here because it's a C++20 extension and we don't
actually need a pointer to the `mutex`, we need the lock. If we did build with
C++20 support I could change `TargetAPILock` to hold onto a shared_ptr for the
mutex, to make it a little bit more obvious, but in the absence of that I think
the current approach is the best we can do.
https://github.com/llvm/llvm-project/pull/131404
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits