[libcxx-commits] [libcxx] [libc++] Make `std::lock_guard` available with `_LIBCPP_HAS_NO_THREADS` (PR #98717)
Petr Hosek via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jul 16 12:55:46 PDT 2024
================
@@ -15,22 +15,18 @@
// lock_guard(mutex_type& m, adopt_lock_t);
#include <mutex>
-#include <cstdlib>
#include <cassert>
#include "types.h"
-#include "test_macros.h"
int main(int, char**) {
- MyMutex m;
{
+ MyMutex m;
m.lock();
std::lock_guard<MyMutex> lg(m, std::adopt_lock);
assert(m.locked);
}
-
- m.lock();
- m.unlock();
+ assert(!m.locked);
----------------
petrhosek wrote:
`m` is out of scope now.
https://github.com/llvm/llvm-project/pull/98717
More information about the libcxx-commits
mailing list