@@ -48,6 +48,8 @@ void p1()
4848
4949int main ()
5050{
51+ const int number_of_tests = 2 ;
52+
5153#if ! defined BOOST_NO_CXX11_DECLTYPE && ! defined BOOST_NO_CXX11_AUTO_DECLARATIONS
5254 std::cout << __FILE__ << " [" << __LINE__ << " ]" << std::endl;
5355 {
@@ -56,24 +58,30 @@ int main()
5658 f1.wait ();
5759 }
5860 std::cout << __FILE__ << " [" << __LINE__ << " ]" << std::endl;
61+ for (int i=0 ; i< number_of_tests; i++)
5962 {
6063 auto f1 = boost::make_ready_future ().then (TestCallback ());
64+ std::cout << __FILE__ << " [" << __LINE__ << " ]" << std::endl;
6165 BOOST_STATIC_ASSERT (std::is_same<decltype (f1), boost::future<boost::future<void > > >::value);
66+ std::cout << __FILE__ << " [" << __LINE__ << " ]" << std::endl;
6267 auto f2 = f1.unwrap ();
68+ std::cout << __FILE__ << " [" << __LINE__ << " ]" << std::endl;
6369 BOOST_STATIC_ASSERT (std::is_same<decltype (f2), boost::future<void > >::value);
70+ std::cout << __FILE__ << " [" << __LINE__ << " ]" << std::endl;
6471 f2.wait ();
72+ std::cout << __FILE__ << " [" << __LINE__ << " ]" << std::endl;
6573 }
6674 std::cout << __FILE__ << " [" << __LINE__ << " ]" << std::endl;
75+ for (int i=0 ; i< number_of_tests; i++)
6776 {
6877 std::cout << __FILE__ << " [" << __LINE__ << " ]" << std::endl;
6978 auto f1 = boost::make_ready_future ().then (TestCallback ());
7079 BOOST_STATIC_ASSERT (std::is_same<decltype (f1), boost::future<boost::future<void > > >::value);
7180 boost::future<void > f2 = f1.get ();
7281 std::cout << __FILE__ << " [" << __LINE__ << " ]" << std::endl;
7382 }
74- #if 0
75- // @fixme this doesn't works.
7683 std::cout << __FILE__ << " [" << __LINE__ << " ]" << std::endl;
84+ for (int i=0 ; i< number_of_tests; i++)
7785 {
7886 auto f1 = boost::make_ready_future ().then (TestCallback ());
7987 BOOST_STATIC_ASSERT (std::is_same<decltype (f1), boost::future<boost::future<void > > >::value);
@@ -84,18 +92,20 @@ int main()
8492 f3.wait ();
8593 }
8694 std::cout << __FILE__ << " [" << __LINE__ << " ]" << std::endl;
95+ for (int i=0 ; i< number_of_tests; i++)
8796 {
8897 boost::make_ready_future ().then (
8998 TestCallback ()).unwrap ().then (TestCallback ()).get ();
9099 }
91100 std::cout << __FILE__ << " [" << __LINE__ << " ]" << std::endl;
101+ for (int i=0 ; i< number_of_tests; i++)
92102 {
93103 boost::future<void > f = boost::async (p1);
94104 f.then (
95105 TestCallback ()).unwrap ().then (TestCallback ()).get ();
96106 }
97- #endif
98107 std::cout << __FILE__ << " [" << __LINE__ << " ]" << std::endl;
108+ for (int i=0 ; i< number_of_tests; i++)
99109 {
100110 auto f1 = boost::make_ready_future ().then (TestCallback ());
101111 BOOST_STATIC_ASSERT (std::is_same<decltype (f1), boost::future<boost::future<void > > >::value);
@@ -106,6 +116,7 @@ int main()
106116
107117
108118 std::cout << __FILE__ << " [" << __LINE__ << " ]" << std::endl;
119+ for (int i=0 ; i< number_of_tests; i++)
109120 {
110121 boost::basic_thread_pool executor;
111122 auto f1 = boost::make_ready_future ().then (executor, TestCallback ());
@@ -114,24 +125,24 @@ int main()
114125 BOOST_STATIC_ASSERT (std::is_same<decltype (f3), boost::future<boost::future<void > > >::value);
115126 f3.wait ();
116127 }
117- #if 0
118- // @fixme this doesn't works.
119128 std::cout << __FILE__ << " [" << __LINE__ << " ]" << std::endl;
129+ for (int i=0 ; i< number_of_tests; i++)
120130 {
121- boost::basic_thread_pool executor;
131+ boost::basic_thread_pool executor ( 1 ) ;
122132
123133 auto f1 = boost::make_ready_future ().then (executor, TestCallback ());
124134 BOOST_STATIC_ASSERT (std::is_same<decltype (f1), boost::future<boost::future<void > > >::value);
125- std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
135+ std::cout << __FILE__ << " [" << __LINE__ << " ] " << int (f1. valid ()) << std::endl;
126136 auto f2 = f1.unwrap ();
127- std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
137+ std::cout << __FILE__ << " [" << __LINE__ << " ] " << int (f2. valid ()) << std::endl;
128138
129139 BOOST_STATIC_ASSERT (std::is_same<decltype (f2), boost::future<void > >::value);
130140 auto f3 = f2.then (executor, TestCallback ());
131141 BOOST_STATIC_ASSERT (std::is_same<decltype (f3), boost::future<boost::future<void > > >::value);
132142 f3.wait ();
133143 }
134144 std::cout << __FILE__ << " [" << __LINE__ << " ]" << std::endl;
145+ for (int i=0 ; i< number_of_tests; i++)
135146 {
136147 boost::basic_thread_pool executor;
137148
@@ -143,7 +154,6 @@ int main()
143154 BOOST_STATIC_ASSERT (std::is_same<decltype (f3), boost::future<boost::future<void > > >::value);
144155 f3.wait ();
145156 }
146- #endif
147157 std::cout << __FILE__ << " [" << __LINE__ << " ]" << std::endl;
148158
149159#endif
0 commit comments