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
14 // template <class Mutex> class unique_lock;
21 #include "test_macros.h"
23 bool unlock_called = false;
28 void unlock() {unlock_called = true;}
35 std::unique_lock<mutex> lk(m);
37 assert(unlock_called == true);
38 assert(lk.owns_lock() == false);
39 #ifndef TEST_HAS_NO_EXCEPTIONS
45 catch (std::system_error& e)
47 assert(e.code().value() == EPERM);
51 #ifndef TEST_HAS_NO_EXCEPTIONS
57 catch (std::system_error& e)
59 assert(e.code().value() == EPERM);