[libc-commits] [libc] [libc] Replace `MutexLock` with `cpp::lock_guard` (PR #89340)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Fri Apr 19 09:44:45 PDT 2024


================
@@ -0,0 +1,67 @@
+//===-- Unittests for mutex -----------------------------------------------===//
+//
+// 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 "src/__support/CPP/mutex.h"
+#include "test/UnitTest/Test.h"
+
+using LIBC_NAMESPACE::cpp::adopt_lock;
+using LIBC_NAMESPACE::cpp::lock_guard;
+
+static const int SIGABRT = 6;
----------------
nickdesaulniers wrote:

Actually, I think it would be simpler to just tracked with a simple boolean if your Mutex has been "double locked" and assert that that's the case rather than deal with signals and dest tests in this unit test.  Is that doable?

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


More information about the libc-commits mailing list