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;
20 #include <shared_mutex>
21 #include <system_error>
23 #include "test_macros.h"
25 bool unlock_called
= false;
30 void unlock_shared() {unlock_called
= true;}
37 std::shared_lock
<mutex
> lk(m
);
39 assert(unlock_called
== true);
40 assert(lk
.owns_lock() == false);
41 #ifndef TEST_HAS_NO_EXCEPTIONS
47 catch (std::system_error
& e
)
49 assert(e
.code().value() == EPERM
);
53 #ifndef TEST_HAS_NO_EXCEPTIONS
59 catch (std::system_error
& e
)
61 assert(e
.code().value() == EPERM
);