1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: no-threads
10 // UNSUPPORTED: c++03, c++11
14 // template <class Mutex> class shared_lock;
16 // template <class Mutex>
17 // void swap(shared_lock<Mutex>& x, shared_lock<Mutex>& y) noexcept;
19 #include <shared_mutex>
22 #include "test_macros.h"
27 void unlock_shared() {}
34 std::shared_lock
<mutex
> lk1(m
);
35 std::shared_lock
<mutex
> lk2
;
37 assert(lk1
.mutex() == nullptr);
38 assert(lk1
.owns_lock() == false);
39 assert(lk2
.mutex() == &m
);
40 assert(lk2
.owns_lock() == true);
41 static_assert(noexcept(swap(lk1
, lk2
)), "non-member swap must be noexcept");