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