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: libcpp-has-no-threads
10 
11 // <mutex>
12 
13 // template <class Mutex> class unique_lock;
14 
15 // mutex_type *mutex() const;
16 
17 #include <mutex>
18 #include <cassert>
19 
20 std::mutex m;
21 
22 int main(int, char**)
23 {
24     std::unique_lock<std::mutex> lk0;
25     assert(lk0.mutex() == nullptr);
26     std::unique_lock<std::mutex> lk1(m);
27     assert(lk1.mutex() == &m);
28     lk1.unlock();
29     assert(lk1.mutex() == &m);
30 
31   return 0;
32 }
33