test_8960.cpp 977 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright (C) 2013 Vicente Botet
  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. #include <boost/thread/thread.hpp>
  6. #include <iostream>
  7. #include <iostream>
  8. #include <boost/thread.hpp>
  9. #include <boost/thread/locks.hpp>
  10. #include <boost/chrono.hpp>
  11. //#include <boost/bind.hpp>
  12. #include <boost/detail/lightweight_test.hpp>
  13. void do_thread()
  14. {
  15. try
  16. {
  17. boost::condition_variable c1;
  18. boost::mutex m1;
  19. boost::unique_lock<boost::mutex> l1(m1);
  20. c1.wait_for(l1, boost::chrono::seconds(1));
  21. }
  22. catch (std::runtime_error& ex)
  23. {
  24. std::cout << "EXCEPTION ! " << ex.what() << std::endl;
  25. BOOST_TEST(false);
  26. }
  27. catch (...)
  28. {
  29. std::cout << "EXCEPTION ! " << std::endl;
  30. BOOST_TEST(false);
  31. }
  32. }
  33. int main()
  34. {
  35. boost::thread th1(&do_thread);
  36. th1.join();
  37. //std::string s1;
  38. //std::cin >> s1;
  39. return boost::report_errors();
  40. }