[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / thread / thread.mutex / thread.lock / thread.lock.unique / thread.lock.unique.mod / member_swap.pass.cpp
blobfc12d3baea202c7d73da952d3954beb8dc048984
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // UNSUPPORTED: no-threads
11 // <mutex>
13 // template <class Mutex> class unique_lock;
15 // void swap(unique_lock& u);
17 #include <mutex>
18 #include <cassert>
20 #include "test_macros.h"
22 struct mutex
24 void lock() {}
25 void unlock() {}
28 mutex m;
30 int main(int, char**)
32 std::unique_lock<mutex> lk1(m);
33 std::unique_lock<mutex> lk2;
34 lk1.swap(lk2);
35 assert(lk1.mutex() == nullptr);
36 assert(lk1.owns_lock() == false);
37 assert(lk2.mutex() == &m);
38 assert(lk2.owns_lock() == true);
40 return 0;