[lldb] Make SBProgress move-only (#124843)
[llvm-project.git] / libcxx / test / std / thread / thread.mutex / thread.lock / thread.lock.unique / thread.lock.unique.cons / mutex_adopt_lock.pass.cpp
blob14db741fa4adc3ecde00a03f05907864ce712c5c
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 //===----------------------------------------------------------------------===//
9 // <mutex>
11 // template <class Mutex> class unique_lock;
13 // unique_lock(mutex_type& m, adopt_lock_t);
15 #include <cassert>
16 #include <memory>
17 #include <mutex>
19 #include "checking_mutex.h"
21 int main(int, char**) {
22 checking_mutex m;
23 m.lock();
24 m.last_try = checking_mutex::none;
25 std::unique_lock<checking_mutex> lk(m, std::adopt_lock_t());
26 assert(m.last_try == checking_mutex::none);
27 assert(lk.mutex() == std::addressof(m));
28 assert(lk.owns_lock());
30 return 0;