blob: bf622311f0132547b0cc05250c27c9283d94ac25 [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, defer_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;
24 std::unique_lock<std::mutex> lk(m, std::defer_lock);
25 assert(lk.mutex() == &m);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000026 assert(lk.owns_lock() == false);
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000027}