blob: 9c3a7b6505a4628e7891d40629873174ee2db32a [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnantf5256e12010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00004//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00007//
8//===----------------------------------------------------------------------===//
Jonathan Roelofs8d86b2e2014-09-05 19:45:05 +00009//
10// UNSUPPORTED: libcpp-has-no-threads
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000011
12// <mutex>
13
14// template <class Mutex> class unique_lock;
15
16// unique_lock(mutex_type& m, adopt_lock_t);
17
18#include <mutex>
19#include <cassert>
20
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000021int main()
22{
Dan Albert1d4a1ed2016-05-25 22:36:09 -070023 std::mutex m;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000024 m.lock();
Dan Albert1d4a1ed2016-05-25 22:36:09 -070025 std::unique_lock<std::mutex> lk(m, std::adopt_lock);
26 assert(lk.mutex() == &m);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000027 assert(lk.owns_lock() == true);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000028}