1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // UNSUPPORTED: libcpp-has-no-threads
11 // UNSUPPORTED: c++98, c++03, c++11
15 // template <class Mutex> class shared_lock;
19 #include <shared_mutex>
22 #include "test_macros.h"
24 bool unlock_called = false;
29 void unlock_shared() {unlock_called = true;}
36 std::shared_lock<mutex> lk(m);
38 assert(unlock_called == true);
39 assert(lk.owns_lock() == false);
40 #ifndef TEST_HAS_NO_EXCEPTIONS
46 catch (std::system_error& e)
48 assert(e.code().value() == EPERM);
52 #ifndef TEST_HAS_NO_EXCEPTIONS
58 catch (std::system_error& e)
60 assert(e.code().value() == EPERM);