• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2012 Vicente J. Botet Escriba
2 //
3 //  Distributed under the Boost Software License, Version 1.0. (See accompanying
4 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 // <boost/thread/lock_factories.hpp>
7 
8 // template <class Mutex> class unique_lock;
9 // unique_lock<Mutex> make_unique_lock(Mutex&, defer_lock_t);
10 
11 // unique_lock(mutex_type& m, adopt_lock_t);
12 
13 #define BOOST_THREAD_VERSION 4
14 
15 #include <boost/thread/lock_factories.hpp>
16 #include <boost/thread/mutex.hpp>
17 #include <boost/detail/lightweight_test.hpp>
18 
main()19 int main()
20 {
21   boost::mutex m;
22 #if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS)
23   auto
24 #else
25   boost::unique_lock<boost::mutex>
26 #endif
27   lk = boost::make_unique_lock(m, boost::defer_lock);
28   BOOST_TEST(lk.mutex() == &m);
29   BOOST_TEST(lk.owns_lock() == false);
30 
31   return boost::report_errors();
32 }
33