lock_guard_adopt_lock_compile_pass.cpp 535 B

12345678910111213141516171819202122
  1. // Copyright (C) 2018 Tom Hughes
  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. // <boost/thread/lock_guard.hpp>
  6. // template <class Mutex> class lock_guard;
  7. // lock_guard(Mutex& m_, adopt_lock_t)
  8. #include <boost/thread/lock_guard.hpp>
  9. #include <boost/thread/mutex.hpp>
  10. #include <boost/detail/lightweight_test.hpp>
  11. boost::mutex m;
  12. void pass()
  13. {
  14. m.lock();
  15. boost::lock_guard<boost::mutex> lk(m, boost::adopt_lock);
  16. }