[Lldb-commits] [lldb] [lldb] Expose the Target API mutex through the SB API (PR #133295)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Thu Mar 27 22:15:51 PDT 2025
================
@@ -0,0 +1,60 @@
+//===-- SBMutex.cpp -------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/API/SBMutex.h"
+#include "lldb/Target/Target.h"
+#include "lldb/Utility/Instrumentation.h"
+#include "lldb/lldb-forward.h"
+#include <memory>
+#include <mutex>
+
+using namespace lldb;
+using namespace lldb_private;
+
+SBMutex::SBMutex() : m_opaque_sp(std::make_shared<std::recursive_mutex>()) {
+ LLDB_INSTRUMENT_VA(this);
+}
+
+SBMutex::SBMutex(const SBMutex &rhs) : m_opaque_sp(rhs.m_opaque_sp) {
----------------
JDevlieghere wrote:
Because SWIG 4.0 doesn't deal well with move-only types. That's how I initially implemented SBLock in https://github.com/llvm/llvm-project/pull/131404, which lead to another RFC to bump the SWIG version: https://discourse.llvm.org/t/rfc-bumping-the-minimum-swig-version-to-4-1-0/85377. There Pavel suggested exposing the mutex instead of the lock and making it copyable.
https://github.com/llvm/llvm-project/pull/133295
More information about the lldb-commits
mailing list