[Lldb-commits] [lldb] [lldb] Expose the Target API lock through the SB API (PR #131404)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Mon Mar 17 01:26:02 PDT 2025
================
@@ -0,0 +1,64 @@
+//===-- SBLockTest.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/SBLock.h"
+#include "lldb/API/SBDebugger.h"
+#include "lldb/API/SBTarget.h"
+#include "gtest/gtest.h"
+#include <atomic>
+#include <chrono>
+#include <thread>
+
+TEST(SBLockTest, LockTest) {
+ lldb::SBDebugger debugger = lldb::SBDebugger::Create();
+ lldb::SBTarget target = debugger.GetDummyTarget();
+
+ std::mutex m;
+ std::condition_variable cv;
+ bool wakeup = false;
+ std::atomic<bool> locked = false;
+
+ std::thread test_thread([&]() {
+ {
+ {
+ std::unique_lock lk(m);
+ cv.wait(lk, [&] { return wakeup; });
+ }
----------------
labath wrote:
maybe use `std::future<void>` instead?
https://github.com/llvm/llvm-project/pull/131404
More information about the lldb-commits
mailing list