copy_assign_fail.cpp 861 B

123456789101112131415161718192021222324252627282930313233
  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. // <boost/thread/locks.hpp>
  6. // template <class Mutex> class reverse_lock;
  7. // reverse_lock& operator=(reverse_lock const&) = delete;
  8. #include <boost/thread/lock_types.hpp>
  9. #include <boost/thread/reverse_lock.hpp>
  10. #include <boost/thread/mutex.hpp>
  11. #include <boost/thread/lock_types.hpp>
  12. int main()
  13. {
  14. boost::mutex m0;
  15. boost::mutex m1;
  16. boost::unique_lock<boost::mutex> lk0(m0);
  17. boost::unique_lock<boost::mutex> lk1(m1);
  18. {
  19. boost::reverse_lock<boost::unique_lock<boost::mutex> > lg0(lk0);
  20. boost::reverse_lock<boost::unique_lock<boost::mutex> > lg1(lk1);
  21. lg1 = lg0;
  22. }
  23. }
  24. #include "../../../../remove_error_code_unused_warning.hpp"