|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r84467 - trunk/libs/thread/test/sync/futures/async
From: vicente.botet_at_[hidden]
Date: 2013-05-24 17:24:14
Author: viboes
Date: 2013-05-24 17:24:13 EDT (Fri, 24 May 2013)
New Revision: 84467
URL: http://svn.boost.org/trac/boost/changeset/84467
Log:
Thread: extend duration check from 200ms to 300ms.
Text files modified:
trunk/libs/thread/test/sync/futures/async/async_pass.cpp | 641 +++++++++++++++++++++++----------------
1 files changed, 374 insertions(+), 267 deletions(-)
Modified: trunk/libs/thread/test/sync/futures/async/async_pass.cpp
==============================================================================
--- trunk/libs/thread/test/sync/futures/async/async_pass.cpp (original)
+++ trunk/libs/thread/test/sync/futures/async/async_pass.cpp 2013-05-24 17:24:13 EDT (Fri, 24 May 2013)
@@ -38,18 +38,21 @@
class A
{
- long data_;
+ long data_;
public:
- typedef long result_type;
+ typedef long result_type;
- explicit A(long i) : data_(i) {}
+ explicit A(long i) :
+ data_(i)
+ {
+ }
- long operator()() const
- {
- boost::this_thread::sleep_for(ms(200));
- return data_;
- }
+ long operator()() const
+ {
+ boost::this_thread::sleep_for(ms(200));
+ return data_;
+ }
};
class MoveOnly
@@ -59,37 +62,38 @@
int value;
- BOOST_THREAD_MOVABLE_ONLY(MoveOnly)
+BOOST_THREAD_MOVABLE_ONLY(MoveOnly)
MoveOnly()
{
- value=0;
- }
- MoveOnly(BOOST_THREAD_RV_REF(MoveOnly))
- {
- value=1;
- }
- MoveOnly& operator=(BOOST_THREAD_RV_REF(MoveOnly))
- {
- value=2;
- return *this;
+ value = 0;
}
+ MoveOnly( BOOST_THREAD_RV_REF(MoveOnly))
+ {
+ value = 1;
+ }
+ MoveOnly& operator=(BOOST_THREAD_RV_REF(MoveOnly))
+ {
+ value = 2;
+ return *this;
+ }
+
+ int operator()()
+ {
+ boost::this_thread::sleep_for(ms(200));
+ return 3;
+ }
+ template <typename OS>
+ friend OS& operator<<(OS& os, MoveOnly const& v)
+ {
+ os << v.value;
+ return os;
+ }
+ };
- int operator()()
- {
- boost::this_thread::sleep_for(ms(200));
- return 3;
- }
- template <typename OS>
- friend OS& operator<<(OS& os, MoveOnly const& v)
- {
- os << v.value;
- return os;
+ namespace boost
+ {
+BOOST_THREAD_DCL_MOVABLE (MoveOnly)
}
-};
-
-namespace boost {
-BOOST_THREAD_DCL_MOVABLE(MoveOnly)
-}
int f0()
{
@@ -113,7 +117,7 @@
boost::interprocess::unique_ptr<int, boost::default_delete<int> > f3_0()
{
boost::this_thread::sleep_for(ms(200));
- boost::interprocess::unique_ptr<int, boost::default_delete<int> > r((new int(3)));
+ boost::interprocess::unique_ptr<int, boost::default_delete<int> > r( (new int(3)));
return boost::move(r);
}
MoveOnly f3_1()
@@ -139,299 +143,382 @@
int main()
{
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<std::endl;
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
{
- try {
- boost::future<int> f = boost::async(f0);
- boost::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- BOOST_TEST(f.get() == 3);
- Clock::time_point t1 = Clock::now();
- BOOST_TEST(t1 - t0 < ms(300));
- } catch (std::exception& ex) {
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<ex.what() << std::endl;
+ try
+ {
+ boost::future<int> f = boost::async(f0);
+ boost::this_thread::sleep_for(ms(300));
+ Clock::time_point t0 = Clock::now();
+ BOOST_TEST(f.get() == 3);
+ Clock::time_point t1 = Clock::now();
+ BOOST_TEST(t1 - t0 < ms(300));
+ }
+ catch (std::exception& ex)
+ {
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << ex.what() << std::endl;
BOOST_TEST(false && "exception thrown");
- } catch (...) {
+ }
+ catch (...)
+ {
BOOST_TEST(false && "exception thrown");
}
}
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<std::endl;
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
{
- try {
- boost::future<int> f = boost::async(boost::launch::async, f0);
- boost::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- BOOST_TEST(f.get() == 3);
- Clock::time_point t1 = Clock::now();
- BOOST_TEST(t1 - t0 < ms(200));
- std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
- } catch (std::exception& ex) {
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<ex.what() << std::endl;
+ try
+ {
+ boost::future<int> f = boost::async(boost::launch::async, f0);
+ boost::this_thread::sleep_for(ms(300));
+ Clock::time_point t0 = Clock::now();
+ BOOST_TEST(f.get() == 3);
+ Clock::time_point t1 = Clock::now();
+ BOOST_TEST(t1 - t0 < ms(300));
+ std::cout << __FILE__ << "[" << __LINE__ << "] " << (t1 - t0).count() << std::endl;
+ }
+ catch (std::exception& ex)
+ {
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << ex.what() << std::endl;
BOOST_TEST(false && "exception thrown");
- } catch (...) {
+ }
+ catch (...)
+ {
BOOST_TEST(false && "exception thrown");
}
-
}
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<std::endl;
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
{
- try {
- boost::future<long> f = boost::async(boost::launch::async, A(3));
- boost::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- BOOST_TEST(f.get() == 3);
- Clock::time_point t1 = Clock::now();
- BOOST_TEST(t1 - t0 < ms(200));
- std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
- } catch (std::exception& ex) {
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<ex.what() << std::endl;
+ try
+ {
+ boost::future<long> f = boost::async(boost::launch::async, A(3));
+ boost::this_thread::sleep_for(ms(300));
+ Clock::time_point t0 = Clock::now();
+ BOOST_TEST(f.get() == 3);
+ Clock::time_point t1 = Clock::now();
+ BOOST_TEST(t1 - t0 < ms(300));
+ std::cout << __FILE__ << "[" << __LINE__ << "] " << (t1 - t0).count() << std::endl;
+ }
+ catch (std::exception& ex)
+ {
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << ex.what() << std::endl;
BOOST_TEST(false && "exception thrown");
- } catch (...) {
+ }
+ catch (...)
+ {
BOOST_TEST(false && "exception thrown");
}
}
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<std::endl;
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
{
- try {
- boost::future<int> f = boost::async(boost::launch::async, BOOST_THREAD_MAKE_RV_REF(MoveOnly()));
-// boost::this_thread::sleep_for(ms(300));
-// Clock::time_point t0 = Clock::now();
-// BOOST_TEST(f.get() == 3);
-// Clock::time_point t1 = Clock::now();
-// BOOST_TEST(t1 - t0 < ms(200));
-// std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
- } catch (std::exception& ex) {
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<ex.what() << std::endl;
+ try
+ {
+ boost::future<int> f = boost::async(boost::launch::async, BOOST_THREAD_MAKE_RV_REF(MoveOnly()));
+ // boost::this_thread::sleep_for(ms(300));
+ // Clock::time_point t0 = Clock::now();
+ // BOOST_TEST(f.get() == 3);
+ // Clock::time_point t1 = Clock::now();
+ // BOOST_TEST(t1 - t0 < ms(300));
+ // std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
+ }
+ catch (std::exception& ex)
+ {
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << ex.what() << std::endl;
BOOST_TEST(false && "exception thrown");
- } catch (...) {
+ }
+ catch (...)
+ {
BOOST_TEST(false && "exception thrown");
}
}
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<std::endl;
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
{
- try {
- boost::future<int> f = boost::async(boost::launch::any, f0);
- boost::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- BOOST_TEST(f.get() == 3);
- Clock::time_point t1 = Clock::now();
- BOOST_TEST(t1 - t0 < ms(200));
- std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
- } catch (std::exception& ex) {
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<ex.what() << std::endl;
+ try
+ {
+ boost::future<int> f = boost::async(boost::launch::any, f0);
+ boost::this_thread::sleep_for(ms(300));
+ Clock::time_point t0 = Clock::now();
+ BOOST_TEST(f.get() == 3);
+ Clock::time_point t1 = Clock::now();
+ BOOST_TEST(t1 - t0 < ms(300));
+ std::cout << __FILE__ << "[" << __LINE__ << "] " << (t1 - t0).count() << std::endl;
+ }
+ catch (std::exception& ex)
+ {
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << ex.what() << std::endl;
BOOST_TEST(false && "exception thrown");
- } catch (...) {
+ }
+ catch (...)
+ {
BOOST_TEST(false && "exception thrown");
}
}
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
std::cout << __FILE__ <<"["<<__LINE__<<"]"<<std::endl;
{
- try {
- boost::future<int> f = boost::async(boost::launch::deferred, f0);
- boost::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- BOOST_TEST(f.get() == 3);
- Clock::time_point t1 = Clock::now();
- BOOST_TEST(t1 - t0 > ms(100));
- } catch (std::exception& ex) {
+ try
+ {
+ boost::future<int> f = boost::async(boost::launch::deferred, f0);
+ boost::this_thread::sleep_for(ms(300));
+ Clock::time_point t0 = Clock::now();
+ BOOST_TEST(f.get() == 3);
+ Clock::time_point t1 = Clock::now();
+ BOOST_TEST(t1 - t0 > ms(100));
+ }
+ catch (std::exception& ex)
+ {
std::cout << __FILE__ <<"["<<__LINE__<<"]"<<ex.what() << std::endl;
BOOST_TEST(false && "exception thrown");
- } catch (...) {
+ }
+ catch (...)
+ {
BOOST_TEST(false && "exception thrown");
}
}
#endif
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<std::endl;
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
{
- try {
- boost::future<int&> f = boost::async(f1);
- boost::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- BOOST_TEST(&f.get() == &i);
- Clock::time_point t1 = Clock::now();
- BOOST_TEST(t1 - t0 < ms(200));
- std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
- } catch (std::exception& ex) {
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<ex.what() << std::endl;
+ try
+ {
+ boost::future<int&> f = boost::async(f1);
+ boost::this_thread::sleep_for(ms(300));
+ Clock::time_point t0 = Clock::now();
+ BOOST_TEST(&f.get() == &i);
+ Clock::time_point t1 = Clock::now();
+ BOOST_TEST(t1 - t0 < ms(300));
+ std::cout << __FILE__ << "[" << __LINE__ << "] " << (t1 - t0).count() << std::endl;
+ }
+ catch (std::exception& ex)
+ {
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << ex.what() << std::endl;
BOOST_TEST(false && "exception thrown");
- } catch (...) {
+ }
+ catch (...)
+ {
BOOST_TEST(false && "exception thrown");
}
}
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<std::endl;
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
{
- try {
- boost::future<int&> f = boost::async(boost::launch::async, f1);
- boost::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- BOOST_TEST(&f.get() == &i);
- Clock::time_point t1 = Clock::now();
- BOOST_TEST(t1 - t0 < ms(200));
- std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
- } catch (std::exception& ex) {
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<ex.what() << std::endl;
+ try
+ {
+ boost::future<int&> f = boost::async(boost::launch::async, f1);
+ boost::this_thread::sleep_for(ms(300));
+ Clock::time_point t0 = Clock::now();
+ BOOST_TEST(&f.get() == &i);
+ Clock::time_point t1 = Clock::now();
+ BOOST_TEST(t1 - t0 < ms(300));
+ std::cout << __FILE__ << "[" << __LINE__ << "] " << (t1 - t0).count() << std::endl;
+ }
+ catch (std::exception& ex)
+ {
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << ex.what() << std::endl;
BOOST_TEST(false && "exception thrown");
- } catch (...) {
+ }
+ catch (...)
+ {
BOOST_TEST(false && "exception thrown");
}
}
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<std::endl;
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
{
- try {
- boost::future<int&> f = boost::async(boost::launch::any, f1);
- boost::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- BOOST_TEST(&f.get() == &i);
- Clock::time_point t1 = Clock::now();
- BOOST_TEST(t1 - t0 < ms(200));
- std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
- } catch (std::exception& ex) {
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<ex.what() << std::endl;
+ try
+ {
+ boost::future<int&> f = boost::async(boost::launch::any, f1);
+ boost::this_thread::sleep_for(ms(300));
+ Clock::time_point t0 = Clock::now();
+ BOOST_TEST(&f.get() == &i);
+ Clock::time_point t1 = Clock::now();
+ BOOST_TEST(t1 - t0 < ms(300));
+ std::cout << __FILE__ << "[" << __LINE__ << "] " << (t1 - t0).count() << std::endl;
+ }
+ catch (std::exception& ex)
+ {
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << ex.what() << std::endl;
BOOST_TEST(false && "exception thrown");
- } catch (...) {
+ }
+ catch (...)
+ {
BOOST_TEST(false && "exception thrown");
}
}
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
std::cout << __FILE__ <<"["<<__LINE__<<"]"<<std::endl;
{
- try {
- boost::future<int&> f = boost::async(boost::launch::deferred, f1);
- boost::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- BOOST_TEST(&f.get() == &i);
- Clock::time_point t1 = Clock::now();
- BOOST_TEST(t1 - t0 > ms(100));
- } catch (std::exception& ex) {
+ try
+ {
+ boost::future<int&> f = boost::async(boost::launch::deferred, f1);
+ boost::this_thread::sleep_for(ms(300));
+ Clock::time_point t0 = Clock::now();
+ BOOST_TEST(&f.get() == &i);
+ Clock::time_point t1 = Clock::now();
+ BOOST_TEST(t1 - t0 > ms(100));
+ }
+ catch (std::exception& ex)
+ {
std::cout << __FILE__ <<"["<<__LINE__<<"]"<<ex.what() << std::endl;
BOOST_TEST(false && "exception thrown");
- } catch (...) {
+ }
+ catch (...)
+ {
BOOST_TEST(false && "exception thrown");
}
}
#endif
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<std::endl;
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
{
- try {
- boost::future<void> f = boost::async(f2);
- boost::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- f.get();
- Clock::time_point t1 = Clock::now();
- BOOST_TEST(t1 - t0 < ms(200));
- std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
- } catch (std::exception& ex) {
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<ex.what() << std::endl;
+ try
+ {
+ boost::future<void> f = boost::async(f2);
+ boost::this_thread::sleep_for(ms(300));
+ Clock::time_point t0 = Clock::now();
+ f.get();
+ Clock::time_point t1 = Clock::now();
+ BOOST_TEST(t1 - t0 < ms(300));
+ std::cout << __FILE__ << "[" << __LINE__ << "] " << (t1 - t0).count() << std::endl;
+ }
+ catch (std::exception& ex)
+ {
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << ex.what() << std::endl;
BOOST_TEST(false && "exception thrown");
- } catch (...) {
+ }
+ catch (...)
+ {
BOOST_TEST(false && "exception thrown");
}
}
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<std::endl;
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
{
- try {
- boost::future<void> f = boost::async(boost::launch::async, f2);
- boost::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- f.get();
- Clock::time_point t1 = Clock::now();
- BOOST_TEST(t1 - t0 < ms(200));
- std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
- } catch (std::exception& ex) {
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<ex.what() << std::endl;
+ try
+ {
+ boost::future<void> f = boost::async(boost::launch::async, f2);
+ boost::this_thread::sleep_for(ms(300));
+ Clock::time_point t0 = Clock::now();
+ f.get();
+ Clock::time_point t1 = Clock::now();
+ BOOST_TEST(t1 - t0 < ms(300));
+ std::cout << __FILE__ << "[" << __LINE__ << "] " << (t1 - t0).count() << std::endl;
+ }
+ catch (std::exception& ex)
+ {
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << ex.what() << std::endl;
BOOST_TEST(false && "exception thrown");
- } catch (...) {
+ }
+ catch (...)
+ {
BOOST_TEST(false && "exception thrown");
}
}
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<std::endl;
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
{
- try {
- boost::future<void> f = boost::async(boost::launch::any, f2);
- boost::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- f.get();
- Clock::time_point t1 = Clock::now();
- BOOST_TEST(t1 - t0 < ms(200));
- std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
- } catch (std::exception& ex) {
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<ex.what() << std::endl;
+ try
+ {
+ boost::future<void> f = boost::async(boost::launch::any, f2);
+ boost::this_thread::sleep_for(ms(300));
+ Clock::time_point t0 = Clock::now();
+ f.get();
+ Clock::time_point t1 = Clock::now();
+ BOOST_TEST(t1 - t0 < ms(300));
+ std::cout << __FILE__ << "[" << __LINE__ << "] " << (t1 - t0).count() << std::endl;
+ }
+ catch (std::exception& ex)
+ {
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << ex.what() << std::endl;
BOOST_TEST(false && "exception thrown");
- } catch (...) {
+ }
+ catch (...)
+ {
BOOST_TEST(false && "exception thrown");
}
}
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
std::cout << __FILE__ <<"["<<__LINE__<<"]"<<std::endl;
{
- try {
- boost::future<void> f = boost::async(boost::launch::deferred, f2);
- boost::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- f.get();
- Clock::time_point t1 = Clock::now();
- BOOST_TEST(t1 - t0 > ms(100));
- } catch (std::exception& ex) {
+ try
+ {
+ boost::future<void> f = boost::async(boost::launch::deferred, f2);
+ boost::this_thread::sleep_for(ms(300));
+ Clock::time_point t0 = Clock::now();
+ f.get();
+ Clock::time_point t1 = Clock::now();
+ BOOST_TEST(t1 - t0 > ms(100));
+ }
+ catch (std::exception& ex)
+ {
std::cout << __FILE__ <<"["<<__LINE__<<"]"<<ex.what() << std::endl;
BOOST_TEST(false && "exception thrown");
- } catch (...) {
+ }
+ catch (...)
+ {
BOOST_TEST(false && "exception thrown");
}
}
#endif
-
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<std::endl;
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
{
- try {
+ try
+ {
boost::future<MoveOnly> f = boost::async(&f3_1);
- boost::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- BOOST_TEST(f.get().value == 1);
- Clock::time_point t1 = Clock::now();
- BOOST_TEST(t1 - t0 < ms(200));
- } catch (std::exception& ex) {
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<ex.what() << std::endl;
+ boost::this_thread::sleep_for(ms(300));
+ Clock::time_point t0 = Clock::now();
+ BOOST_TEST(f.get().value == 1);
+ Clock::time_point t1 = Clock::now();
+ BOOST_TEST(t1 - t0 < ms(300));
+ }
+ catch (std::exception& ex)
+ {
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << ex.what() << std::endl;
BOOST_TEST(false && "exception thrown");
- } catch (...) {
+ }
+ catch (...)
+ {
BOOST_TEST(false && "exception thrown");
}
}
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<std::endl;
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
{
- try {
+ try
+ {
boost::future<MoveOnly> f;
f = boost::async(&f3_1);
- boost::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- BOOST_TEST(f.get().value == 1);
- Clock::time_point t1 = Clock::now();
- BOOST_TEST(t1 - t0 < ms(200));
- } catch (std::exception& ex) {
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<ex.what() << std::endl;
+ boost::this_thread::sleep_for(ms(300));
+ Clock::time_point t0 = Clock::now();
+ BOOST_TEST(f.get().value == 1);
+ Clock::time_point t1 = Clock::now();
+ BOOST_TEST(t1 - t0 < ms(300));
+ }
+ catch (std::exception& ex)
+ {
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << ex.what() << std::endl;
BOOST_TEST(false && "exception thrown");
- } catch (...) {
+ }
+ catch (...)
+ {
BOOST_TEST(false && "exception thrown");
}
}
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<std::endl;
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << std::endl;
{
- try {
- boost::future<boost::interprocess::unique_ptr<int, boost::default_delete<int> > > f = boost::async(&f3_0);
- boost::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- BOOST_TEST(*f.get() == 3);
- Clock::time_point t1 = Clock::now();
- BOOST_TEST(t1 - t0 < ms(200));
- std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
- } catch (std::exception& ex) {
- std::cout << __FILE__ <<"["<<__LINE__<<"]"<<ex.what() << std::endl;
+ try
+ {
+ boost::future<boost::interprocess::unique_ptr<int, boost::default_delete<int> > > f = boost::async(&f3_0);
+ boost::this_thread::sleep_for(ms(300));
+ Clock::time_point t0 = Clock::now();
+ BOOST_TEST(*f.get() == 3);
+ Clock::time_point t1 = Clock::now();
+ BOOST_TEST(t1 - t0 < ms(300));
+ std::cout << __FILE__ << "[" << __LINE__ << "] " << (t1 - t0).count() << std::endl;
+ }
+ catch (std::exception& ex)
+ {
+ std::cout << __FILE__ << "[" << __LINE__ << "]" << ex.what() << std::endl;
BOOST_TEST(false && "exception thrown");
- } catch (...) {
+ }
+ catch (...)
+ {
BOOST_TEST(false && "exception thrown");
}
}
@@ -439,35 +526,45 @@
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
std::cout << __FILE__ <<"["<<__LINE__<<"]"<<std::endl;
{
- try {
- boost::future<boost::interprocess::unique_ptr<int, boost::default_delete<int> > > f = boost::async(boost::launch::async, &f3, 3);
- boost::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- BOOST_TEST(*f.get() == 3);
- Clock::time_point t1 = Clock::now();
- BOOST_TEST(t1 - t0 < ms(200));
- std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
- } catch (std::exception& ex) {
+ try
+ {
+ boost::future<boost::interprocess::unique_ptr<int, boost::default_delete<int> > > f = boost::async(boost::launch::async, &f3, 3);
+ boost::this_thread::sleep_for(ms(300));
+ Clock::time_point t0 = Clock::now();
+ BOOST_TEST(*f.get() == 3);
+ Clock::time_point t1 = Clock::now();
+ BOOST_TEST(t1 - t0 < ms(300));
+ std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
+ }
+ catch (std::exception& ex)
+ {
std::cout << __FILE__ <<"["<<__LINE__<<"]"<<ex.what() << std::endl;
BOOST_TEST(false && "exception thrown");
- } catch (...) {
+ }
+ catch (...)
+ {
BOOST_TEST(false && "exception thrown");
}
}
std::cout << __FILE__ <<"["<<__LINE__<<"]"<<std::endl;
{
- try {
- boost::future<boost::interprocess::unique_ptr<int, boost::default_delete<int> > > f = boost::async(&f3, 3);
- boost::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- BOOST_TEST(*f.get() == 3);
- Clock::time_point t1 = Clock::now();
- BOOST_TEST(t1 - t0 < ms(200));
- std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
- } catch (std::exception& ex) {
+ try
+ {
+ boost::future<boost::interprocess::unique_ptr<int, boost::default_delete<int> > > f = boost::async(&f3, 3);
+ boost::this_thread::sleep_for(ms(300));
+ Clock::time_point t0 = Clock::now();
+ BOOST_TEST(*f.get() == 3);
+ Clock::time_point t1 = Clock::now();
+ BOOST_TEST(t1 - t0 < ms(300));
+ std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
+ }
+ catch (std::exception& ex)
+ {
std::cout << __FILE__ <<"["<<__LINE__<<"]"<<ex.what() << std::endl;
BOOST_TEST(false && "exception thrown");
- } catch (...) {
+ }
+ catch (...)
+ {
BOOST_TEST(false && "exception thrown");
}
}
@@ -476,35 +573,45 @@
#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
std::cout << __FILE__ <<"["<<__LINE__<<"]"<<std::endl;
{
- try {
- boost::future<boost::interprocess::unique_ptr<int, boost::default_delete<int> > > f = boost::async(boost::launch::async, &f4, boost::interprocess::unique_ptr<int, boost::default_delete<int> >(new int(3)));
- boost::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- BOOST_TEST(*f.get() == 3);
- Clock::time_point t1 = Clock::now();
- BOOST_TEST(t1 - t0 < ms(200));
- std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
- } catch (std::exception& ex) {
+ try
+ {
+ boost::future<boost::interprocess::unique_ptr<int, boost::default_delete<int> > > f = boost::async(boost::launch::async, &f4, boost::interprocess::unique_ptr<int, boost::default_delete<int> >(new int(3)));
+ boost::this_thread::sleep_for(ms(300));
+ Clock::time_point t0 = Clock::now();
+ BOOST_TEST(*f.get() == 3);
+ Clock::time_point t1 = Clock::now();
+ BOOST_TEST(t1 - t0 < ms(300));
+ std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
+ }
+ catch (std::exception& ex)
+ {
std::cout << __FILE__ <<"["<<__LINE__<<"]"<<ex.what() << std::endl;
BOOST_TEST(false && "exception thrown");
- } catch (...) {
+ }
+ catch (...)
+ {
BOOST_TEST(false && "exception thrown");
}
}
std::cout << __FILE__ <<"["<<__LINE__<<"]"<<std::endl;
{
- try {
- boost::future<boost::interprocess::unique_ptr<int, boost::default_delete<int> > > f = boost::async(&f4, boost::interprocess::unique_ptr<int, boost::default_delete<int> >(new int(3)));
- boost::this_thread::sleep_for(ms(300));
- Clock::time_point t0 = Clock::now();
- BOOST_TEST(*f.get() == 3);
- Clock::time_point t1 = Clock::now();
- BOOST_TEST(t1 - t0 < ms(200));
- std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
- } catch (std::exception& ex) {
+ try
+ {
+ boost::future<boost::interprocess::unique_ptr<int, boost::default_delete<int> > > f = boost::async(&f4, boost::interprocess::unique_ptr<int, boost::default_delete<int> >(new int(3)));
+ boost::this_thread::sleep_for(ms(300));
+ Clock::time_point t0 = Clock::now();
+ BOOST_TEST(*f.get() == 3);
+ Clock::time_point t1 = Clock::now();
+ BOOST_TEST(t1 - t0 < ms(300));
+ std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
+ }
+ catch (std::exception& ex)
+ {
std::cout << __FILE__ <<"["<<__LINE__<<"]"<<ex.what() << std::endl;
BOOST_TEST(false && "exception thrown");
- } catch (...) {
+ }
+ catch (...)
+ {
BOOST_TEST(false && "exception thrown");
}
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk