|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r51110 - sandbox/interthreads/libs/interthreads/test
From: vicente.botet_at_[hidden]
Date: 2009-02-08 16:09:40
Author: viboes
Date: 2009-02-08 16:09:39 EST (Sun, 08 Feb 2009)
New Revision: 51110
URL: http://svn.boost.org/trac/boost/changeset/51110
Log:
interthreads version 0.4
* New free functions for all the AsynchronousCompletionToken operations, providing a higher degree of freedom.
* Missing have_all_values(), have_all_exception() and are_all_ready() functions on AsynchronousCompletionToken fusion tuples.
* get_all: getting all the values from a tuple of AsynchronousCompletionToken works now.
* fork_after overloaded for a single dependency
* wait_all overloaded for a single ACT.
* wait_for_all evaluate one of its elements on the current thread
* No need to use wait_and_get() on thread_specific_shared_ptr<> to synchronize with the decoration if the thread is created using a AsynchronousExecutor decorator. In this case the synchro is done before returning the AsynchronousCompletionToken. See the tutorial and the mono_thread_id example.
Text files modified:
sandbox/interthreads/libs/interthreads/test/Jamfile.v2 | 42 ++-
sandbox/interthreads/libs/interthreads/test/data_types.hpp | 20
sandbox/interthreads/libs/interthreads/test/test_ae.hpp | 412 ++++++++++++++++++++++++++++++++-------
sandbox/interthreads/libs/interthreads/test/test_basic_threader.cpp | 140 ++++++++++---
sandbox/interthreads/libs/interthreads/test/test_launcher.cpp | 108 ++++++++-
sandbox/interthreads/libs/interthreads/test/test_thread_decorator.cpp | 132 ++++++------
sandbox/interthreads/libs/interthreads/test/test_thread_pool.cpp | 129 ++++++++++-
sandbox/interthreads/libs/interthreads/test/test_thread_shared_ptr.cpp | 114 +++++-----
sandbox/interthreads/libs/interthreads/test/test_threader.cpp | 151 +++++++++++---
9 files changed, 917 insertions(+), 331 deletions(-)
Modified: sandbox/interthreads/libs/interthreads/test/Jamfile.v2
==============================================================================
--- sandbox/interthreads/libs/interthreads/test/Jamfile.v2 (original)
+++ sandbox/interthreads/libs/interthreads/test/Jamfile.v2 2009-02-08 16:09:39 EST (Sun, 08 Feb 2009)
@@ -1,7 +1,7 @@
-# (C) Copyright William E. Kempf 2001.
-# (C) Copyright 2007 Anthony Williams.
-# (C) Copyright 2008-2009 Vicente Botet Escriba.
-# Distributed under the Boost Software License, Version 1.0. (See accompanying
+# (C) Copyright William E. Kempf 2001.
+# (C) Copyright 2007 Anthony Williams.
+# (C) Copyright 2008-2009 Vicente Botet Escriba.
+# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# Boost.InterThreads test Jamfile
@@ -20,47 +20,53 @@
import testing ;
project
- : requirements <library>/boost/test//boost_unit_test_framework/<link>static
+ : requirements
+ <library>/boost/test//boost_unit_test_framework/<link>static
<library>../build//boost_interthreads
-
+ <library>/boost/thread//boost_thread/<link>static
+
<include>.
<include>../../..
<threading>multi
-# <target-os>cygwin
-# <threadapi>pthread
-# <variant>debug
+ <target-os>cygwin
+ <threadapi>pthread
+ <variant>debug
# <define>BOOST_THREAD_HAS_THREAD_ATTR
;
rule interthreads-run ( sources * )
{
- return
+ return
[ run $(sources) : : : <link>static ]
# [ run $(sources) ../../../../libs/thread/build//boost_thread : : : : $(sources[1]:B)_lib ]
;
-}
+}
{
test-suite "tests"
- :
+ :
# [ interthreads-run move_test.cpp ]
- [ interthreads-run test_basic_threader.cpp ]
+# [ interthreads-run test_thread_move.cpp ]
+# [ interthreads-run test_basic_threader.cpp ]
[ interthreads-run test_launcher.cpp ]
- [ interthreads-run test_threader.cpp ]
- [ interthreads-run test_thread_pool.cpp ]
+ [ interthreads-run test_threader.cpp ]
+ [ interthreads-run test_thread_pool.cpp ]
[ interthreads-run test_thread_decorator.cpp ]
[ interthreads-run test_thread_shared_ptr.cpp ]
;
test-suite "example"
- :
+ :
[ interthreads-run ../example/hello_world.cpp ]
[ interthreads-run ../example/mono_thread_id.cpp ]
[ interthreads-run ../example/basic_keep_alive.cpp ../example/async_ostream.cpp ]
[ interthreads-run ../example/multiple_algorithms.cpp ]
-
-
+# [ interthreads-run ../example/parallel_sort.cpp ]
+# [ interthreads-run ../example/x_sort.cpp ]
+# [ interthreads-run ../example/x_sort2.cpp ]
+
+
;
}
Modified: sandbox/interthreads/libs/interthreads/test/data_types.hpp
==============================================================================
--- sandbox/interthreads/libs/interthreads/test/data_types.hpp (original)
+++ sandbox/interthreads/libs/interthreads/test/data_types.hpp 2009-02-08 16:09:39 EST (Sun, 08 Feb 2009)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Vicente J. Botet Escriba 2008-20009. Distributed under the Boost
+// (C) Copyright Vicente J. Botet Escriba 2008-2009. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
@@ -42,9 +42,9 @@
void sleep(int sec)
{
- boost::xtime t;
- boost::xtime_get(&t,1);
- t.sec += sec;
+ boost::xtime t;
+ boost::xtime_get(&t,1);
+ t.sec += sec;
boost::thread::sleep(t);
}
}
@@ -56,11 +56,11 @@
{
unsigned value;
typedef unsigned result_type;
-
+
non_copyable_functor():
value(0)
{}
-
+
unsigned operator()()
{
value=999;
@@ -72,11 +72,11 @@
{
unsigned value;
typedef int result_type;
-
+
copyable_functor():
value(0)
{}
-
+
int operator()()
{
value=999;
@@ -91,9 +91,9 @@
{
std::cout
// << '<' << typeid(x).name() << '>'
- << x
+ << x << " "
// << "</" << typeid(x).name() << '>'
- << std::endl
+ //<< std::endl
;
}
};
Modified: sandbox/interthreads/libs/interthreads/test/test_ae.hpp
==============================================================================
--- sandbox/interthreads/libs/interthreads/test/test_ae.hpp (original)
+++ sandbox/interthreads/libs/interthreads/test/test_ae.hpp 2009-02-08 16:09:39 EST (Sun, 08 Feb 2009)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Vicente J. Botet Escriba 2008-20009. Distributed under the Boost
+// (C) Copyright Vicente J. Botet Escriba 2008-2009. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
@@ -29,8 +29,10 @@
int test_value2;
int test_value3;
int simple_thread() {
+ //std::cout << ">> simple_thread" << std::endl;
test_value=999;
sleep(2);
+ //std::cout << "<< simple_thread" << std::endl;
return test_value;
}
static std::string test_string_value;
@@ -42,8 +44,10 @@
}
int simple_thread2() {
+ //std::cout << ">>simple_thread2" << std::endl;
test_value2=111;
sleep(5);
+ //std::cout << "<<simple_thread2" << std::endl;
return test_value2;
}
@@ -86,97 +90,237 @@
}
namespace aetst {
-
+#if 0
template <typename AE>
-void do_test_member_fork(AE& ae) {
+void do_test_member_lazy_fork(AE& ae) {
test_value=0;
- BOOST_AUTO(act, ae.fork(simple_thread));
- BOOST_CHECK_EQUAL(act.is_ready(), false);
- BOOST_CHECK_EQUAL(act.has_value(), false);
- BOOST_CHECK_EQUAL(act.has_exception(), false);
+ //BOOST_AUTO(act2, bith::lazy_fork(ae, simple_thread));
+ //boost::packaged_task<int> act2(bith::lazy_fork(ae, simple_thread));
+ //BOOST_AUTO(act, act2.get_future());
+ boost::shared_ptr<boost::packaged_task<int> > tsk(new boost::packaged_task<int>(simple_thread));
+ tsk->set_wait_callback(bith::detail::invoke_lazy_task<int>());
+ boost::shared_ptr<boost::packaged_task<int> > tsk2(tsk);
+ boost::unique_future<int> act=tsk2->get_future();
int res_value = act.get();
+ #if 1
BOOST_CHECK_EQUAL(test_value, 999);
BOOST_CHECK_EQUAL(res_value, 999);
BOOST_CHECK_EQUAL(act.is_ready(), true);
BOOST_CHECK_EQUAL(act.has_value(), true);
BOOST_CHECK_EQUAL(act.has_exception(), false);
-}
+ #endif
+}
+#endif
template <typename AE>
-void do_test_member_fork_move(AE& ae) {
+void do_test_member_fork(AE& ae) {
test_value=0;
- typename AE::template handle<int>::type act = ae.fork(simple_thread);
+ BOOST_AUTO(act, ae.fork(simple_thread));
+ BOOST_CHECK_EQUAL(bith::is_ready(act), false);
+ BOOST_CHECK_EQUAL(bith::has_value(act), false);
+ BOOST_CHECK_EQUAL(bith::has_exception(act), false);
+ int res_value = bith::get(act);
+ BOOST_CHECK_EQUAL(test_value, 999);
+ BOOST_CHECK_EQUAL(res_value, 999);
+ BOOST_CHECK_EQUAL(bith::is_ready(act), true);
+ BOOST_CHECK_EQUAL(bith::has_value(act), true);
+ BOOST_CHECK_EQUAL(bith::has_exception(act), false);
+ std::cout << "<<do_test_member_fork" << std::endl;
+
+}
+template <typename AE>
+void do_test_member_fork_thr(AE& ae) {
+ test_value=0;
+ BOOST_AUTO(act, ae.fork(simple_thread));
+ BOOST_CHECK_EQUAL(bith::interruption_requested(act), false);
+ BOOST_CHECK_EQUAL(bith::joinable(act), true);
+ bith::join(act);
+ BOOST_CHECK_EQUAL(test_value, 999);
+ BOOST_CHECK_EQUAL(bith::interruption_requested(act), false);
+ BOOST_CHECK_EQUAL(bith::joinable(act), false);
+ std::cout << "<<do_test_member_fork" << std::endl;
+
+}
+template <typename AE>
+void do_test_member_fork_m_fut(AE& ae) {
+ test_value=0;
+ typename AE::template handle<int>::type act = ae.fork(simple_thread);
BOOST_CHECK_EQUAL(act.is_ready(), false);
BOOST_CHECK_EQUAL(act.has_value(), false);
BOOST_CHECK_EQUAL(act.has_exception(), false);
- int res_value = act.get();
+ int res_value = bith::get(act);
BOOST_CHECK_EQUAL(test_value, 999);
BOOST_CHECK_EQUAL(res_value, 999);
- BOOST_CHECK_EQUAL(act.is_ready(), true);
- BOOST_CHECK_EQUAL(act.has_value(), true);
- BOOST_CHECK_EQUAL(act.has_exception(), false);
-}
+ BOOST_CHECK_EQUAL(bith::is_ready(act), true);
+ BOOST_CHECK_EQUAL(bith::has_value(act), true);
+ BOOST_CHECK_EQUAL(bith::has_exception(act), false);
+ std::cout << "<<do_test_member_fork_m_fut" << std::endl;
+}
+template <typename AE>
+void do_test_member_fork_m_thr(AE& ae) {
+ test_value=0;
+ typename AE::template handle<int>::type act;
+ act = ae.fork(simple_thread);
+ bith::join(act);
+ BOOST_CHECK_EQUAL(test_value, 999);
+ std::cout << "<<do_test_member_fork_m_thr" << std::endl;
+}
template <typename AE>
void do_test_member_fork_bind(AE& ae) {
test_value=0;
- BOOST_AUTO(act, ae.fork(boost::bind(simple_thread_1, 2)));
- int res_value = act.get();
+ BOOST_AUTO(act, ae.fork(boost::bind(simple_thread_1, 2)));
+ bith::wait(act);
BOOST_CHECK_EQUAL(test_value, 2);
- BOOST_CHECK_EQUAL(res_value, 2);
-}
+ std::cout << "<<do_test_member_fork_bind" << std::endl;
+}
template <typename AE>
void do_test_fork(AE& ae) {
test_value=0;
- BOOST_AUTO(act, bith::fork(ae, simple_thread));
- int res_value = act.get();
+ BOOST_AUTO(act, bith::fork(ae, simple_thread));
+ int res_value = bith::get(act);
BOOST_CHECK_EQUAL(test_value, 999);
BOOST_CHECK_EQUAL(res_value, 999);
-}
+ std::cout << "<<do_test_fork" << std::endl;
+}
+
+template <typename AE>
+void do_test_fork_thr(AE& ae) {
+ test_value=0;
+ BOOST_AUTO(act, bith::fork(ae, simple_thread));
+ bith::join(act);
+ BOOST_CHECK_EQUAL(test_value, 999);
+ std::cout << "<<do_test_fork_thr" << std::endl;
+}
template <typename AE>
void do_test_fork_1(AE& ae) {
test_value=0;
- BOOST_AUTO(act, bith::fork(ae, simple_thread_1, 2));
- int res_value = act.get();
+ BOOST_AUTO(act, bith::fork(ae, simple_thread_1, 2));
+ int res_value = bith::get(act);
BOOST_CHECK_EQUAL(test_value, 2);
BOOST_CHECK_EQUAL(res_value, 2);
-}
+ std::cout << "<<do_test_fork_1" << std::endl;
+}
+
+template <typename AE>
+void do_test_fork_1_thr(AE& ae) {
+ test_value=0;
+ BOOST_AUTO(act, bith::fork(ae, simple_thread_1, 2));
+ bith::wait(act);
+ BOOST_CHECK_EQUAL(test_value, 2);
+ std::cout << "<<do_test_fork_1" << std::endl;
+}
template <typename AE>
void do_test_creation_through_functor(AE& ae)
{
copyable_functor f;
BOOST_AUTO(act,bith::fork(ae, f));
- int res = act.get();
- BOOST_CHECK_EQUAL(res, 999);
+ int res_value = bith::get(act);
+ BOOST_CHECK_EQUAL(res_value, 999);
+ std::cout << "<<do_test_creation_through_functor" << std::endl;
+}
+
+template <typename AE>
+void do_test_creation_through_functor_thr(AE& ae)
+{
+ copyable_functor f;
+ BOOST_AUTO(act,bith::fork(ae, f));
+ bith::wait(act);
+ BOOST_CHECK_EQUAL(test_value, 999);
+ std::cout << "<<do_test_creation_through_functor_thr" << std::endl;
}
template <typename AE>
void do_test_creation_through_reference_wrapper(AE& ae)
{
non_copyable_functor f;
- BOOST_AUTO(act,bith::fork(ae, boost::bind(boost::ref(f))));
-
- unsigned res = act.get();
- BOOST_CHECK_EQUAL(res, 999u);
+ BOOST_AUTO(act,bith::fork(ae, boost::bind(boost::ref(f))));
+
+ unsigned res_value = bith::get(act);
+ BOOST_CHECK_EQUAL(res_value, 999u);
+ BOOST_CHECK_EQUAL(f.value, 999u);
+ std::cout << "<<do_test_creation_through_reference_wrapper" << std::endl;
+}
+
+template <typename AE>
+void do_test_creation_through_reference_wrapper_thr(AE& ae)
+{
+ non_copyable_functor f;
+ BOOST_AUTO(act,bith::fork(ae, boost::bind(boost::ref(f))));
+ bith::wait(act);
BOOST_CHECK_EQUAL(f.value, 999u);
+ std::cout << "<<do_test_creation_through_reference_wrapper_thr" << std::endl;
+}
+
+template <typename AE>
+void do_test_wait(AE& ae) {
+ BOOST_AUTO(act,bith::fork(ae, simple_thread));
+ bith::wait(act);
+ std::cout << "<<do_test_wait" << std::endl;
}
template <typename AE>
void do_test_wait_all(AE& ae) {
BOOST_AUTO(tple,bith::fork_all(ae, simple_thread, simple_thread));
bith::wait_all(tple);
+ std::cout << "<<do_test_wait_all" << std::endl;
+}
+
+template <typename AE>
+void do_test_wait_until(AE& ae) {
+ BOOST_AUTO(act,bith::fork(ae, simple_thread));
+ bool b = bith::wait_until(act,boost::get_system_time()+boost::posix_time::seconds(1));
+ BOOST_CHECK_EQUAL(b, false);
+ b = bith::wait_until(act,boost::get_system_time()+boost::posix_time::seconds(3));
+ BOOST_CHECK_EQUAL(b, true);
+ std::cout << "<<do_test_wait_until" << std::endl;
+}
+
+template <typename AE>
+void do_test_wait_all_until(AE& ae) {
+ BOOST_AUTO(tple,bith::fork_all(ae, simple_thread, simple_thread));
+ bool b = bith::wait_all_until(tple,boost::get_system_time()+boost::posix_time::seconds(1));
+ BOOST_CHECK_EQUAL(b, false);
+ b = bith::wait_all_until(tple,boost::get_system_time()+boost::posix_time::seconds(3));
+ BOOST_CHECK_EQUAL(b, true);
+ std::cout << "<<do_test_wait_all_until" << std::endl;
+}
+
+template <typename AE>
+void do_test_wait_for(AE& ae) {
+ BOOST_AUTO(tple,bith::fork(ae, simple_thread));
+ bool b = bith::wait_for(tple,boost::posix_time::seconds(1));
+ BOOST_CHECK_EQUAL(b, false);
+ b = bith::wait_for(tple,boost::posix_time::seconds(3));
+ BOOST_CHECK_EQUAL(b, true);
+ std::cout << "<<do_test_wait_for" << std::endl;
+}
+
+template <typename AE>
+void do_test_wait_all_for(AE& ae) {
+ BOOST_AUTO(tple,bith::fork_all(ae, simple_thread, simple_thread));
+ bool b = bith::wait_all_for(tple,boost::posix_time::seconds(1));
+ BOOST_CHECK_EQUAL(b, false);
+ b = bith::wait_all_for(tple,boost::posix_time::seconds(3));
+ BOOST_CHECK_EQUAL(b, true);
+ std::cout << "<<do_test_wait_all_for" << std::endl;
}
template <typename AE>
void do_test_wait_for_any(AE& ae) {
+ std::cout << ">>do_test_wait_for_any" << std::endl;
BOOST_AUTO(res, bith::wait_for_any(ae, simple_thread2, simple_thread));
BOOST_CHECK_EQUAL(res.first, 1u);
- BOOST_CHECK_EQUAL(res.second, 999);
+ BOOST_CHECK_EQUAL(res.second, 999);
res = bith::wait_for_any(ae, simple_thread, simple_thread2);
BOOST_CHECK_EQUAL(res.first, 0u);
- BOOST_CHECK_EQUAL(res.second, 999);
+ BOOST_CHECK_EQUAL(res.second, 999);
+ boost::this_thread::sleep(boost::posix_time::milliseconds(5000));
+ std::cout << "<<do_test_wait_for_any" << std::endl;
+
+
}
template <typename AE>
@@ -186,21 +330,49 @@
bith::set_all(tple,res);
BOOST_CHECK_EQUAL(bfus::at_c<0>(res), 999);
BOOST_CHECK_EQUAL(bfus::at_c<1>(res), 111);
-
- bfus::for_each(res, print_xml());
-
+
+ //bfus::for_each(res, print_xml());
+ //std::cout << std::endl;
+ std::cout << "<<do_test_fork_1" << std::endl;
+
+}
+template <typename AE>
+void do_test_get(AE& ae) {
+ BOOST_AUTO(act,bith::fork(ae, simple_thread));
+ bith::get(act);
+ BOOST_AUTO(res_value,bith::get(act));
+ BOOST_CHECK_EQUAL(test_value, 999);
+ BOOST_CHECK_EQUAL(res_value, 999);
+ std::cout << "<<do_test_get" << std::endl;
+}
+
+template <typename AE>
+void do_test_get_all(AE& ae) {
+ BOOST_AUTO(tple,bith::fork_all(ae, simple_thread, simple_thread2));
+// bith::wait_all(tple);
+ BOOST_AUTO(res,bith::get_all(tple));
+ BOOST_CHECK_EQUAL(bfus::at_c<0>(res), 999);
+ BOOST_CHECK_EQUAL(bfus::at_c<1>(res), 111);
+ //bfus::for_each(res, print_xml());
+ //std::cout << std::endl;
+ std::cout << "<<do_test_get_all" << std::endl;
}
template <typename AE>
void do_test_wait_for_all(AE& ae) {
BOOST_AUTO(res, bith::wait_for_all(ae, simple_thread, simple_thread2));
- bfus::for_each(res, print_xml());
+ //bfus::for_each(res, print_xml());
+ //std::cout << std::endl;
+
BOOST_CHECK_EQUAL(bfus::at_c<0>(res), 999);
BOOST_CHECK_EQUAL(bfus::at_c<1>(res), 111);
res = bith::wait_for_all(ae, simple_thread2, simple_thread);
- bfus::for_each(res, print_xml());
+ //bfus::for_each(res, print_xml());
+ //std::cout << std::endl;
+
BOOST_CHECK_EQUAL(bfus::at_c<0>(res), 111);
BOOST_CHECK_EQUAL(bfus::at_c<1>(res), 999);
+ std::cout << "<<do_test_wait_for_all" << std::endl;
}
@@ -211,24 +383,97 @@
test_value=0;
BOOST_AUTO(act,ae.fork(simple_thread));
- BOOST_CHECK_EQUAL(act.interruption_requested(), false);
- BOOST_CHECK_EQUAL(act.is_ready(), false);
- BOOST_CHECK_EQUAL(act.has_value(), false);
- BOOST_CHECK_EQUAL(act.has_exception(), false);
- BOOST_CHECK_EQUAL(act.joinable(), true);
- act.detach();
- BOOST_CHECK_EQUAL(act.joinable(), false);
- int res_value = act.get();
+ BOOST_CHECK_EQUAL(bith::interruption_requested(act), false);
+ BOOST_CHECK_EQUAL(bith::joinable(act), true);
+ bith::detach(act);
+ BOOST_CHECK_EQUAL(bith::joinable(act), false);
+ bith::join(act);
BOOST_CHECK_EQUAL(test_value, 999);
- BOOST_CHECK_EQUAL(res_value, 999);
-}
+ std::cout << "<<do_test_member_fork_detach" << std::endl;
+}
+
+template <typename AE>
+void do_test_join(AE& ae) {
+ BOOST_AUTO(act,bith::fork(ae, simple_thread));
+ bith::join(act);
+ std::cout << "<<do_test_join" << std::endl;
+}
+
+template <typename AE>
+void do_test_join_m(AE& ae) {
+ typename AE::template handle<int>::type act = ae.fork(simple_thread);
+ bith::join(act);
+ std::cout << "<<do_test_join_m" << std::endl;
+}
template <typename AE>
void do_test_join_all(AE& ae) {
BOOST_AUTO(tple,bith::fork_all(ae, simple_thread, simple_thread));
- bith::join_all(tple);
+ bith::join_all(tple);
+ std::cout << "<<do_test_join_all" << std::endl;
}
+template <typename AE>
+void do_test_join_until(AE& ae) {
+ BOOST_AUTO(act,bith::fork(ae, simple_thread));
+ bool b = bith::join_until(act,boost::get_system_time()+boost::posix_time::seconds(1));
+ BOOST_CHECK_EQUAL(b, false);
+ b = bith::join_until(act,boost::get_system_time()+boost::posix_time::seconds(3));
+ BOOST_CHECK_EQUAL(b, true);
+ std::cout << "<<do_test_join_until" << std::endl;
+}
+
+template <typename AE>
+void do_test_join_until_m(AE& ae) {
+ //BOOST_AUTO(act,bith::fork(ae, simple_thread));
+ typename AE::template handle<int>::type act = ae.fork(simple_thread);
+ bool b = bith::join_until(act,boost::get_system_time()+boost::posix_time::seconds(1));
+ BOOST_CHECK_EQUAL(b, false);
+ b = bith::join_until(act,boost::get_system_time()+boost::posix_time::seconds(3));
+ BOOST_CHECK_EQUAL(b, true);
+ std::cout << "<<do_test_join_until_m" << std::endl;
+}
+
+template <typename AE>
+void do_test_join_all_until(AE& ae) {
+ BOOST_AUTO(tple,bith::fork_all(ae, simple_thread, simple_thread));
+ bool b = bith::join_all_until(tple,boost::get_system_time()+boost::posix_time::seconds(1));
+ BOOST_CHECK_EQUAL(b, false);
+ b = bith::join_all_until(tple,boost::get_system_time()+boost::posix_time::seconds(3));
+ BOOST_CHECK_EQUAL(b, true);
+ std::cout << "<<do_test_join_all_until" << std::endl;
+}
+
+template <typename AE>
+void do_test_join_for(AE& ae) {
+ BOOST_AUTO(act,bith::fork(ae, simple_thread));
+ bool b = bith::join_for(act,boost::posix_time::seconds(1));
+ BOOST_CHECK_EQUAL(b, false);
+ b = bith::join_for(act,boost::posix_time::seconds(3));
+ BOOST_CHECK_EQUAL(b, true);
+ std::cout << "<<do_test_join_for" << std::endl;
+}
+
+template <typename AE>
+void do_test_join_for_m(AE& ae) {
+ //BOOST_AUTO(act,boost::move(bith::fork(ae, simple_thread)));
+ typename AE::template handle<int>::type act = ae.fork(simple_thread);
+ bool b = bith::join_for(act,boost::posix_time::seconds(1));
+ BOOST_CHECK_EQUAL(b, false);
+ b = bith::join_for(act,boost::posix_time::seconds(3));
+ BOOST_CHECK_EQUAL(b, true);
+ std::cout << "<<do_test_join_for_m" << std::endl;
+}
+
+template <typename AE>
+void do_test_join_all_for(AE& ae) {
+ BOOST_AUTO(tple,bith::fork_all(ae, simple_thread, simple_thread));
+ bool b = bith::join_all_for(tple,boost::posix_time::seconds(1));
+ BOOST_CHECK_EQUAL(b, false);
+ b = bith::join_all_for(tple,boost::posix_time::seconds(3));
+ BOOST_CHECK_EQUAL(b, true);
+ std::cout << "<<do_test_join_all_for" << std::endl;
+}
template <typename AE>
@@ -237,71 +482,92 @@
bool failed=false;
boost::mutex::scoped_lock lk(m);
BOOST_AUTO(act,bith::fork(ae, interruption_point_thread, &m,&failed));
+ bith::interrupt(act);
+ //act.interrupt();
+ BOOST_CHECK_EQUAL(bith::interruption_requested(act), true);
+ lk.unlock();
+ bith::wait(act);
+ //boost::this_thread::sleep(boost::posix_time::milliseconds(5000));
+
+ BOOST_CHECK(!failed);
+ std::cout << "<<do_test_thread_interrupts_at_interruption_point" << std::endl;
+}
+
+template <typename AE>
+void do_test_thread_interrupts_at_interruption_point_m(AE& ae) {
+ boost::mutex m;
+ bool failed=false;
+ boost::mutex::scoped_lock lk(m);
+ BOOST_AUTO(act,bith::fork(ae, interruption_point_thread, &m,&failed));
act.interrupt();
BOOST_CHECK_EQUAL(act.interruption_requested(), true);
lk.unlock();
- act.wait();
+ bith::wait(act);
BOOST_CHECK(!failed);
-}
+ std::cout << "<<do_test_thread_interrupts_at_interruption_point_m" << std::endl;
+}
template <typename AE>
-void do_test_fork_after_get(AE& ae) {
+void do_test_fork_after_get(AE& ae) {
test_value=0;
test_value2=0;
test_value3=0;
- BOOST_AUTO(actT, bith::fork_all(ae, my_simple_thread, my_simple_thread2));
-
+ BOOST_AUTO(actT, bith::fork_all(ae, my_simple_thread, my_simple_thread2));
+
#ifndef ACT_WRAPPER
typename AE:: template handle<int>::type res;
- bith::fork_after(ae, my_simple_thread3, actT, res);
+ bith::fork_after(ae, my_simple_thread3, actT, res);
sleep(5);
#else
- BOOST_AUTO(act,bith::fork_after(ae, my_simple_thread3, actT));
+ BOOST_AUTO(act,bith::fork_after(ae, my_simple_thread3, actT));
#endif
-
- int res =act.get();
+
+ int res =bith::get(act);
BOOST_CHECK_EQUAL(test_value3, 333);
BOOST_CHECK_EQUAL(res, 333);
-}
+ std::cout << "<<do_test_fork_after_get" << std::endl;
+}
template <typename AE>
-void do_test_fork_after_wait(AE& ae) {
+void do_test_fork_after_wait(AE& ae) {
test_value=0;
test_value2=0;
test_value3=0;
BOOST_AUTO(actT, bith::fork_all(ae, my_simple_thread, my_simple_thread2));
-
+
#ifndef ACT_WRAPPER
typename AE:: template handle<int>::type res;
- bith::fork_after(ae, my_simple_thread3, actT, res);
+ bith::fork_after(ae, my_simple_thread3, actT, res);
sleep(5);
#else
- BOOST_AUTO(act,bith::fork_after(ae, my_simple_thread3, actT));
+ BOOST_AUTO(act,bith::fork_after(ae, my_simple_thread3, actT));
#endif
- act.wait();
-
+ bith::wait(act);
+
BOOST_CHECK_EQUAL(test_value3, 333);
+ std::cout << "<<do_test_fork_after_wait" << std::endl;
-}
+}
template <typename AE>
-void do_test_fork_after_join(AE& ae) {
+void do_test_fork_after_join(AE& ae) {
test_value=0;
test_value2=0;
test_value3=0;
BOOST_AUTO(actT, bith::fork_all(ae, my_simple_thread, my_simple_thread2));
-
+
#ifndef ACT_WRAPPER
typename AE:: template handle<int>::type res;
- bith::fork_after(ae, my_simple_thread3, actT, res);
+ bith::fork_after(ae, my_simple_thread3, actT, res);
sleep(5);
#else
- BOOST_AUTO(act,bith::fork_after(ae, my_simple_thread3, actT));
+ BOOST_AUTO(act,bith::fork_after(ae, my_simple_thread3, actT));
#endif
- act.join();
-
+ bith::join(act);
+
BOOST_CHECK_EQUAL(test_value3, 333);
+ std::cout << "<<do_test_fork_after_join" << std::endl;
-}
+}
}
#endif
Modified: sandbox/interthreads/libs/interthreads/test/test_basic_threader.cpp
==============================================================================
--- sandbox/interthreads/libs/interthreads/test/test_basic_threader.cpp (original)
+++ sandbox/interthreads/libs/interthreads/test/test_basic_threader.cpp 2009-02-08 16:09:39 EST (Sun, 08 Feb 2009)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Vicente J. Botet Escriba 2008-20009. Distributed under the Boost
+// (C) Copyright Vicente J. Botet Escriba 2008-2009. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
@@ -22,53 +22,80 @@
namespace bfus = boost::fusion;
-void do_test_member_fork_move() {
+#if 0
+void do_test_member_fork_detach() {
bith::basic_threader ae;
- #if 0
- aetst::do_test_member_fork_move(ae);
- return;
+ aetst::do_test_member_fork_detach(ae);
+}
+void do_test_member_fork_thr() {
+ bith::basic_threader ae;
+ aetst::do_test_member_fork_thr(ae);
+}
+
+void do_test_member_fork_m() {
+ bith::basic_threader ae;
+ #if 1
+ aetst::do_test_member_fork_m_thr(ae);
#endif
test_value=0;
- boost::thread act(ae.fork(simple_thread));
+ boost::thread act(ae.fork(simple_thread));
act.join();
BOOST_CHECK_EQUAL(test_value, 999);
-}
+}
+
void do_test_member_fork_bind() {
bith::basic_threader ae;
+ aetst::do_test_member_fork_bind(ae);
+}
+
+void do_test_member_fork_bind2() {
+ bith::basic_threader ae;
#if 0
aetst::do_test_member_fork_bind(ae);
return;
#endif
test_value=0;
- boost::thread act(ae.fork(boost::bind(simple_thread_1, 2)));
+ boost::thread act(ae.fork(boost::bind(simple_thread_1, 2)));
act.join();
BOOST_CHECK_EQUAL(test_value, 2);
-}
+}
-void do_test_fork() {
+void do_test_fork_thr() {
bith::basic_threader ae;
- #if 0
- aetst::do_test_fork(ae);
- return;
- #endif
- test_value=0;
- boost::thread act = bith::fork(ae, simple_thread);
- act.join();
- BOOST_CHECK_EQUAL(test_value, 999);
-}
+ aetst::do_test_fork_thr(ae);
+ //test_value=0;
+ //boost::thread act = bith::fork(ae, simple_thread);
+ //act.join();
+ //BOOST_CHECK_EQUAL(test_value, 999);
+}
-void do_test_fork_1() {
+void do_test_fork_1_thr() {
bith::basic_threader ae;
- #if 0
- aetst::do_test_fork_1(ae);
- return;
- #endif
- test_value=0;
- boost::thread act = bith::fork(ae, simple_thread_1, 2);
- act.join();
- BOOST_CHECK_EQUAL(test_value, 2);
-}
+ aetst::do_test_fork_1_thr(ae);
+ //test_value=0;
+ //boost::thread act = bith::fork(ae, simple_thread_1, 2);
+ //act.join();
+ //BOOST_CHECK_EQUAL(test_value, 2);
+}
+
+void do_test_creation_through_reference_wrapper_thr()
+{
+ bith::basic_threader ae;
+ aetst::do_test_creation_through_reference_wrapper_thr(ae);
+}
+
+void do_test_creation_through_functor_thr()
+{
+ bith::basic_threader ae;
+ aetst::do_test_creation_through_functor_thr(ae);
+}
+
+void do_test_thread_interrupts_at_interruption_point() {
+ bith::basic_threader ae;
+ aetst::do_test_thread_interrupts_at_interruption_point(ae);
+}
+
#if 0
// this do not works because boost::thread is movable-only and boost::fusion::tuple works only with CopyContructible types
@@ -78,20 +105,63 @@
type handles = bith::fork_all(ae, simple_thread, simple_thread);
//BOOST_AUTO(handles,bith::fork_all(ae, simple_thread, simple_thread));
bith::join_all(tple);
-
+
}
#endif
+
+void do_test_wait() {
+ bith::basic_threader ae;
+ aetst::do_test_wait(ae);
+}
+
+void do_test_wait_until() {
+ bith::basic_threader ae;
+ aetst::do_test_wait_until(ae);
+}
+
+void do_test_wait_for() {
+ bith::basic_threader ae;
+ aetst::do_test_wait_for(ae);
+}
+
+void do_test_join() {
+ bith::basic_threader ae;
+ aetst::do_test_join_m(ae);
+}
+
+void do_test_join_until() {
+ bith::basic_threader ae;
+ aetst::do_test_join_until_m(ae);
+}
+#endif
+void do_test_join_for_m() {
+ bith::basic_threader ae;
+ aetst::do_test_join_for_m(ae);
+}
+
test_suite* init_unit_test_suite(int, char*[])
{
test_suite* test = BOOST_TEST_SUITE("basic_threader");
- test->add(BOOST_TEST_CASE(&do_test_member_fork_move));
- test->add(BOOST_TEST_CASE(&do_test_member_fork_bind));
- test->add(BOOST_TEST_CASE(&do_test_fork));
- test->add(BOOST_TEST_CASE(&do_test_fork_1));
+ test->add(BOOST_TEST_CASE(&do_test_join_for_m));
+
#if 0
+ //test->add(BOOST_TEST_CASE(&do_test_member_fork));
+ //test->add(BOOST_TEST_CASE(&do_test_member_fork_m));
+ test->add(BOOST_TEST_CASE(&do_test_member_fork_bind));
+ test->add(BOOST_TEST_CASE(&do_test_fork_thr));
+ test->add(BOOST_TEST_CASE(&do_test_fork_1_thr));
+
+ test->add(BOOST_TEST_CASE(&do_test_wait));
+ test->add(BOOST_TEST_CASE(&do_test_wait_until));
+ test->add(BOOST_TEST_CASE(&do_test_wait_for));
+
+ //test->add(BOOST_TEST_CASE(&do_test_member_fork_detach));
+ test->add(BOOST_TEST_CASE(&do_test_join));
+ test->add(BOOST_TEST_CASE(&do_test_join_until));
+
test->add(BOOST_TEST_CASE(&do_test_join_all));
-#endif
+#endif
return test;
}
Modified: sandbox/interthreads/libs/interthreads/test/test_launcher.cpp
==============================================================================
--- sandbox/interthreads/libs/interthreads/test/test_launcher.cpp (original)
+++ sandbox/interthreads/libs/interthreads/test/test_launcher.cpp 2009-02-08 16:09:39 EST (Sun, 08 Feb 2009)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Vicente J. Botet Escriba 2008-20009. Distributed under the Boost
+// (C) Copyright Vicente J. Botet Escriba 2008-2009. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
@@ -21,18 +21,24 @@
namespace bith = boost::interthreads;
namespace bfus = boost::fusion;
-void do_test_member_fork() {
+#if 0
+void do_test_member_lazy_fork() {
bith::shared_launcher ae;
- aetst::do_test_member_fork(ae);
+ aetst::do_test_member_lazy_fork(ae);
}
-
+#endif
void do_test_member_fork_move_unique() {
bith::launcher ae;
- aetst::do_test_member_fork_move(ae);
+ aetst::do_test_member_fork_m_fut(ae);
+}
+
+void do_test_member_fork() {
+ bith::shared_launcher ae;
+ aetst::do_test_member_fork(ae);
}
void do_test_member_fork_move() {
bith::shared_launcher ae;
- aetst::do_test_member_fork_move(ae);
+ aetst::do_test_member_fork_m_fut(ae);
}
void do_test_member_fork_bind() {
@@ -43,7 +49,7 @@
void do_test_member_fork_bind_move() {
bith::launcher ae;
test_value=0;
- boost::unique_future<int> fut = ae.fork(boost::bind(simple_thread_1, 2));
+ boost::unique_future<int> fut = ae.fork(boost::bind(simple_thread_1, 2));
int res_value = fut.get();
BOOST_CHECK_EQUAL(test_value, 2);
BOOST_CHECK_EQUAL(res_value, 2);
@@ -87,7 +93,7 @@
bith::launcher ae;
copyable_functor f;
boost::unique_future<int> act=bith::fork(ae, f);
-
+
int res = act.get();
BOOST_CHECK_EQUAL(res, 999);
}
@@ -98,6 +104,42 @@
aetst::do_test_creation_through_reference_wrapper(ae);
}
+
+void do_test_wait() {
+ bith::shared_launcher ae;
+ aetst::do_test_wait(ae);
+}
+
+void do_test_wait_until() {
+ bith::shared_launcher ae;
+ aetst::do_test_wait_until(ae);
+}
+
+void do_test_wait_for() {
+ bith::shared_launcher ae;
+ aetst::do_test_wait_for(ae);
+}
+
+void do_test_join() {
+ bith::shared_launcher ae;
+ aetst::do_test_join(ae);
+}
+
+void do_test_join_until() {
+ bith::shared_launcher ae;
+ aetst::do_test_join_until(ae);
+}
+
+void do_test_join_for() {
+ bith::shared_launcher ae;
+ aetst::do_test_join_for(ae);
+}
+
+void do_test_join_all() {
+ bith::shared_launcher ae;
+ aetst::do_test_join_all(ae);
+}
+
void do_test_wait_all() {
bith::shared_launcher ae;
aetst::do_test_wait_all(ae);
@@ -113,25 +155,39 @@
aetst::do_test_set_all(ae);
}
+void do_test_get() {
+ bith::shared_launcher ae;
+ aetst::do_test_get(ae);
+}
+
+void do_test_get_all() {
+ bith::shared_launcher ae;
+ aetst::do_test_set_all(ae);
+}
+
void do_test_wait_for_all() {
bith::shared_launcher ae;
aetst::do_test_wait_for_all(ae);
}
-void do_test_fork_after_wait() {
+void do_test_wait_all_until() {
+ bith::shared_launcher ae;
+ aetst::do_test_wait_all_until(ae);
+}
+
+void do_test_fork_after_wait() {
bith::shared_launcher ae;
aetst::do_test_fork_after_wait(ae);
-}
-void do_test_fork_after_get() {
+}
+void do_test_fork_after_get() {
bith::shared_launcher ae;
aetst::do_test_fork_after_get(ae);
-}
+}
test_suite* init_unit_test_suite(int, char*[])
{
test_suite* test = BOOST_TEST_SUITE("launcher");
-
- test->add(BOOST_TEST_CASE(&do_test_member_fork_move));
+
test->add(BOOST_TEST_CASE(&do_test_member_fork));
test->add(BOOST_TEST_CASE(&do_test_member_fork_move));
test->add(BOOST_TEST_CASE(&do_test_member_fork_bind));
@@ -142,14 +198,32 @@
test->add(BOOST_TEST_CASE(&do_test_fork_1_move));
test->add(BOOST_TEST_CASE(&do_test_creation_through_functor));
test->add(BOOST_TEST_CASE(&do_test_creation_through_reference_wrapper));
+
+ test->add(BOOST_TEST_CASE(&do_test_get));
+ test->add(BOOST_TEST_CASE(&do_test_wait));
+ test->add(BOOST_TEST_CASE(&do_test_wait_until));
+ test->add(BOOST_TEST_CASE(&do_test_wait_for));
test->add(BOOST_TEST_CASE(&do_test_wait_all));
- test->add(BOOST_TEST_CASE(&do_test_wait_for_any));
+ test->add(BOOST_TEST_CASE(&do_test_wait_all_until));
test->add(BOOST_TEST_CASE(&do_test_set_all));
+ test->add(BOOST_TEST_CASE(&do_test_get_all));
+
+ test->add(BOOST_TEST_CASE(&do_test_join));
+ test->add(BOOST_TEST_CASE(&do_test_join_until));
+ test->add(BOOST_TEST_CASE(&do_test_join_for));
+ test->add(BOOST_TEST_CASE(&do_test_join_all));
+ //test->add(BOOST_TEST_CASE(&do_test_join_all_until));
+ //test->add(BOOST_TEST_CASE(&do_test_join_all_for));
+
+
test->add(BOOST_TEST_CASE(&do_test_wait_for_all));
+ test->add(BOOST_TEST_CASE(&do_test_wait_for_any));
test->add(BOOST_TEST_CASE(&do_test_fork_after_wait));
test->add(BOOST_TEST_CASE(&do_test_fork_after_get));
- #if 0
- #endif
+
+#if 0
+ test->add(BOOST_TEST_CASE(&do_test_member_lazy_fork));
+#endif
return test;
}
Modified: sandbox/interthreads/libs/interthreads/test/test_thread_decorator.cpp
==============================================================================
--- sandbox/interthreads/libs/interthreads/test/test_thread_decorator.cpp (original)
+++ sandbox/interthreads/libs/interthreads/test/test_thread_decorator.cpp 2009-02-08 16:09:39 EST (Sun, 08 Feb 2009)
@@ -1,8 +1,8 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Roland Schwarz 2006.
-// (C) Copyright Vicente J. Botet Escriba 2008-20009.
-// Distributed under the Boost Software License, Version 1.0.
+// (C) Copyright Roland Schwarz 2006.
+// (C) Copyright Vicente J. Botet Escriba 2008-2009.
+// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/interthreads for documentation.
@@ -18,60 +18,60 @@
boost::mutex out_global_mutex;
void cleanup_i(boost::thread::id* data) {
- boost::mutex::scoped_lock out_guard(out_global_mutex);
- std::cout << "cleanup_i " << *data <<" " << boost::this_thread::get_id()<<std::endl;
+ boost::mutex::scoped_lock out_guard(out_global_mutex);
+ std::cout << "cleanup_i " << *data <<" " << boost::this_thread::get_id()<<std::endl;
}
boost::thread_specific_ptr<boost::thread::id> specific_ptr_i(cleanup_i);
boost::once_flag global_init_flag=BOOST_ONCE_INIT;
void global_init() {
- boost::mutex::scoped_lock out_guard(out_global_mutex);
- std::cout << "global_init" << boost::this_thread::get_id()<<std::endl;
+ boost::mutex::scoped_lock out_guard(out_global_mutex);
+ std::cout << "global_init" << boost::this_thread::get_id()<<std::endl;
}
void thread_init_1() {
- specific_ptr_i.reset(new boost::thread::id(boost::this_thread::get_id()));
- boost::call_once(global_init_flag, global_init);
- boost::mutex::scoped_lock out_guard(out_global_mutex);
- std::cout << "thread_init_1 " << boost::this_thread::get_id()<<std::endl;
+ specific_ptr_i.reset(new boost::thread::id(boost::this_thread::get_id()));
+ boost::call_once(global_init_flag, global_init);
+ boost::mutex::scoped_lock out_guard(out_global_mutex);
+ std::cout << "thread_init_1 " << boost::this_thread::get_id()<<std::endl;
}
void thread_init_2() {
- boost::mutex::scoped_lock out_guard(out_global_mutex);
- std::cout << "thread_init_2 " << boost::this_thread::get_id()<<std::endl;
+ boost::mutex::scoped_lock out_guard(out_global_mutex);
+ std::cout << "thread_init_2 " << boost::this_thread::get_id()<<std::endl;
}
void sleep(int sec)
{
- boost::xtime t;
- boost::xtime_get(&t,1);
- t.sec += sec;
+ boost::xtime t;
+ boost::xtime_get(&t,1);
+ t.sec += sec;
boost::thread::sleep(t);
}
void run1() {
- sleep(3);
- {
- boost::mutex::scoped_lock out_guard(out_global_mutex);
- std::cout << "long operation on" << boost::this_thread::get_id()<<std::endl;
- }
- sleep(10);
- {
- boost::mutex::scoped_lock out_guard(out_global_mutex);
- std::cout << "long operation end" << boost::this_thread::get_id()<<std::endl;
+ sleep(3);
+ {
+ boost::mutex::scoped_lock out_guard(out_global_mutex);
+ std::cout << "long operation on" << boost::this_thread::get_id()<<std::endl;
+ }
+ sleep(10);
+ {
+ boost::mutex::scoped_lock out_guard(out_global_mutex);
+ std::cout << "long operation end" << boost::this_thread::get_id()<<std::endl;
}
}
void run2() {
- sleep(1);
- {
- boost::mutex::scoped_lock out_guard(out_global_mutex);
- std::cout << "long operation on" << boost::this_thread::get_id()<<std::endl;
- }
- sleep(20);
- {
- boost::mutex::scoped_lock out_guard(out_global_mutex);
- std::cout << "long operation end" << boost::this_thread::get_id()<<std::endl;
+ sleep(1);
+ {
+ boost::mutex::scoped_lock out_guard(out_global_mutex);
+ std::cout << "long operation on" << boost::this_thread::get_id()<<std::endl;
+ }
+ sleep(20);
+ {
+ boost::mutex::scoped_lock out_guard(out_global_mutex);
+ std::cout << "long operation end" << boost::this_thread::get_id()<<std::endl;
}
}
@@ -82,42 +82,42 @@
int main(int argc, char* argv[])
{
boost::interthreads::decorate();
-
- //boost::interthreads::thread_tuple<2> gr(boost::interthreads::make_decorator(run1), boost::interthreads::make_decorator(run2));
+
+ //boost::interthreads::thread_tuple<2> gr(boost::interthreads::make_decorator(run1), boost::interthreads::make_decorator(run2));
boost::interthreads::thread_decorator run1p(run1);
boost::interthreads::thread_decorator run2p(run2);
- boost::thread pt1(run1p);
- boost::thread pt2(run2p);
-// boost::thread pt1(boost::interthreads::make_decorator(run1));
-// boost::thread pt2(boost::interthreads::make_decorator(run2));
- sleep(1);
- boost::thread pt12(run1p);
-// boost::thread pt12(boost::interthreads::make_decorator(run1));
- sleep(1);
- {
- boost::mutex::scoped_lock out_guard(out_global_mutex);
- std::cout << "waiting pt1" <<std::endl;
- }
-
- pt1.join();
- {
- boost::mutex::scoped_lock out_guard(out_global_mutex);
- std::cout << "waiting pt12" <<std::endl;
- }
- pt12.join();
- //gr.join_all();
- {
- boost::mutex::scoped_lock out_guard(out_global_mutex);
- std::cout << "waiting pt2" <<std::endl;
- }
- pt2.join();
-
- {
- boost::mutex::scoped_lock out_guard(out_global_mutex);
- std::cout << "END" <<std::endl;
+ boost::thread pt1(run1p);
+ boost::thread pt2(run2p);
+// boost::thread pt1(boost::interthreads::make_decorator(run1));
+// boost::thread pt2(boost::interthreads::make_decorator(run2));
+ sleep(1);
+ boost::thread pt12(run1p);
+// boost::thread pt12(boost::interthreads::make_decorator(run1));
+ sleep(1);
+ {
+ boost::mutex::scoped_lock out_guard(out_global_mutex);
+ std::cout << "waiting pt1" <<std::endl;
+ }
+
+ pt1.join();
+ {
+ boost::mutex::scoped_lock out_guard(out_global_mutex);
+ std::cout << "waiting pt12" <<std::endl;
+ }
+ pt12.join();
+ //gr.join_all();
+ {
+ boost::mutex::scoped_lock out_guard(out_global_mutex);
+ std::cout << "waiting pt2" <<std::endl;
+ }
+ pt2.join();
+
+ {
+ boost::mutex::scoped_lock out_guard(out_global_mutex);
+ std::cout << "END" <<std::endl;
}
- return 0;
+ return 0;
}
Modified: sandbox/interthreads/libs/interthreads/test/test_thread_pool.cpp
==============================================================================
--- sandbox/interthreads/libs/interthreads/test/test_thread_pool.cpp (original)
+++ sandbox/interthreads/libs/interthreads/test/test_thread_pool.cpp 2009-02-08 16:09:39 EST (Sun, 08 Feb 2009)
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Vicente J. Botet Escriba 2008-20009. Distributed under the Boost
+// (C) Copyright Vicente J. Botet Escriba 2008-2009. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
@@ -8,7 +8,7 @@
//
//////////////////////////////////////////////////////////////////////////////
-
+
#include "boost/interthreads/typeof/scheduler.hpp"
#include "boost/interthreads/algorithm.hpp"
#include <libs/interthreads/test/data_types.hpp>
@@ -37,25 +37,29 @@
> pool_type;
#endif
-void do_test_member_fork() {
- boost::tp::poolsize s(2);
- pool_type ae(s);
+void do_test_member_fork_detach() {
+ pool_type ae(boost::tp::poolsize(2));
+ aetst::do_test_member_fork_detach(ae);
+}
+
+void do_test_member_fork() {
+ pool_type ae(boost::tp::poolsize(2));
aetst::do_test_member_fork(ae);
-}
+}
void do_test_member_fork_bind() {
pool_type ae(boost::tp::poolsize(2));
aetst::do_test_member_fork_bind(ae);
-}
+}
void do_test_fork() {
pool_type ae(boost::tp::poolsize(2));
aetst::do_test_fork(ae);
-}
+}
void do_test_fork_1() {
pool_type ae(boost::tp::poolsize(2));
aetst::do_test_fork_1(ae);
-}
+}
void do_test_creation_through_reference_wrapper()
{
@@ -68,18 +72,71 @@
pool_type ae(boost::tp::poolsize(2));
aetst::do_test_creation_through_functor(ae);
}
+void do_test_wait() {
+ pool_type ae(boost::tp::poolsize(2));
+ aetst::do_test_wait(ae);
+}
+
+void do_test_wait_until() {
+ pool_type ae(boost::tp::poolsize(2));
+ aetst::do_test_wait_until(ae);
+}
+
+void do_test_wait_for() {
+ pool_type ae(boost::tp::poolsize(2));
+ aetst::do_test_wait_for(ae);
+}
+
+void do_test_join() {
+ pool_type ae(boost::tp::poolsize(2));
+ aetst::do_test_join(ae);
+}
+
+void do_test_join_until() {
+ pool_type ae(boost::tp::poolsize(2));
+ aetst::do_test_join_until(ae);
+}
+
+void do_test_join_for() {
+ pool_type ae(boost::tp::poolsize(2));
+ aetst::do_test_join_for(ae);
+}
+
+void do_test_join_all() {
+ pool_type ae(boost::tp::poolsize(2));
+ aetst::do_test_join_all(ae);
+}
+
+void do_test_join_all_until() {
+ pool_type ae(boost::tp::poolsize(2));
+ aetst::do_test_join_all_until(ae);
+}
+void do_test_join_all_for() {
+ pool_type ae(boost::tp::poolsize(2));
+ aetst::do_test_join_all_for(ae);
+}
void do_test_thread_interrupts_at_interruption_point() {
pool_type ae(boost::tp::poolsize(2));
- aetst::do_test_thread_interrupts_at_interruption_point(ae);
-}
+ aetst::do_test_thread_interrupts_at_interruption_point_m(ae);
+}
void do_test_wait_all() {
pool_type ae(boost::tp::poolsize(2));
aetst::do_test_wait_all(ae);
}
+void do_test_wait_all_until() {
+ pool_type ae(boost::tp::poolsize(2));
+ aetst::do_test_wait_all_until(ae);
+}
+
+void do_test_wait_all_for() {
+ pool_type ae(boost::tp::poolsize(2));
+ aetst::do_test_wait_all_for(ae);
+}
+
void do_test_wait_for_any() {
pool_type ae(boost::tp::poolsize(2));
aetst::do_test_wait_for_any(ae);
@@ -90,24 +147,39 @@
aetst::do_test_set_all(ae);
}
+void do_test_get() {
+ pool_type ae(boost::tp::poolsize(2));
+ aetst::do_test_get(ae);
+}
+
+
+void do_test_get_all() {
+ pool_type ae(boost::tp::poolsize(2));
+ aetst::do_test_set_all(ae);
+}
+
void do_test_wait_for_all() {
pool_type ae(boost::tp::poolsize(2));
aetst::do_test_wait_for_all(ae);
}
-
-void do_test_fork_after_wait() {
+#if 0
+void do_test_fork_after_wait() {
pool_type ae(boost::tp::poolsize(2));
aetst::do_test_fork_after_wait(ae);
-}
-void do_test_fork_after_get() {
+}
+void do_test_fork_after_get() {
pool_type ae(boost::tp::poolsize(2));
aetst::do_test_fork_after_get(ae);
-}
+}
+#endif
test_suite* init_unit_test_suite(int, char*[])
{
test_suite* test = BOOST_TEST_SUITE("scheduler");
-
+
+#if 0 // DO NOT WORK YET
+ test->add(BOOST_TEST_CASE(&do_test_member_fork_detach));
+#endif
test->add(BOOST_TEST_CASE(&do_test_member_fork));
test->add(BOOST_TEST_CASE(&do_test_member_fork_bind));
test->add(BOOST_TEST_CASE(&do_test_fork));
@@ -115,12 +187,33 @@
test->add(BOOST_TEST_CASE(&do_test_thread_interrupts_at_interruption_point));
test->add(BOOST_TEST_CASE(&do_test_creation_through_functor));
test->add(BOOST_TEST_CASE(&do_test_creation_through_reference_wrapper));
+
+ test->add(BOOST_TEST_CASE(&do_test_get));
+ test->add(BOOST_TEST_CASE(&do_test_wait));
+ test->add(BOOST_TEST_CASE(&do_test_wait_until));
+ test->add(BOOST_TEST_CASE(&do_test_wait_for));
+
test->add(BOOST_TEST_CASE(&do_test_wait_all));
+ test->add(BOOST_TEST_CASE(&do_test_wait_all_until));
+ test->add(BOOST_TEST_CASE(&do_test_wait_all_for));
test->add(BOOST_TEST_CASE(&do_test_set_all));
+ test->add(BOOST_TEST_CASE(&do_test_get_all));
+
+ test->add(BOOST_TEST_CASE(&do_test_join));
+ test->add(BOOST_TEST_CASE(&do_test_join_until));
+ test->add(BOOST_TEST_CASE(&do_test_join_for));
+ test->add(BOOST_TEST_CASE(&do_test_join_all));
+ test->add(BOOST_TEST_CASE(&do_test_join_all_until));
+ test->add(BOOST_TEST_CASE(&do_test_join_all_for));
+
+
test->add(BOOST_TEST_CASE(&do_test_wait_for_all));
+
+#if 0 // DO NOT WORK YET
+ test->add(BOOST_TEST_CASE(&do_test_wait_for_any));
test->add(BOOST_TEST_CASE(&do_test_fork_after_wait));
test->add(BOOST_TEST_CASE(&do_test_fork_after_get));
- test->add(BOOST_TEST_CASE(&do_test_wait_for_any));
+#endif
return test;
}
Modified: sandbox/interthreads/libs/interthreads/test/test_thread_shared_ptr.cpp
==============================================================================
--- sandbox/interthreads/libs/interthreads/test/test_thread_shared_ptr.cpp (original)
+++ sandbox/interthreads/libs/interthreads/test/test_thread_shared_ptr.cpp 2009-02-08 16:09:39 EST (Sun, 08 Feb 2009)
@@ -1,13 +1,13 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Roland Schwarz 2006.
-// (C) Copyright Vicente J. Botet Escriba 2008-20009.
-// Distributed under the Boost Software License, Version 1.0.
+// (C) Copyright Roland Schwarz 2006.
+// (C) Copyright Vicente J. Botet Escriba 2008-2009.
+// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/interthreads for documentation.
//
-// Based on the shared.cpp example from the threadalert library of Roland Schwarz
+// Based on the shared.cpp example from the threadalert library of Roland Schwarz
//////////////////////////////////////////////////////////////////////////////
#include <boost/thread/mutex.hpp>
boost::mutex out_global_mutex;
@@ -19,31 +19,31 @@
void sleep(int sec)
{
- boost::xtime t;
- boost::xtime_get(&t,1); t.sec += sec; boost::thread::sleep(t);
+ boost::xtime t;
+ boost::xtime_get(&t,1); t.sec += sec; boost::thread::sleep(t);
}
// A state class living in shared memory.
// The class must have its own sync mechanism.
class state {
public:
- state() : result(0)
- {}
- void set_result(int n)
- {
- boost::mutex::scoped_lock lock(monitor);
- result = n;
- }
- int get_result()
- {
- boost::mutex::scoped_lock lock(monitor);
- return result;
- }
+ state() : result(0)
+ {}
+ void set_result(int n)
+ {
+ boost::mutex::scoped_lock lock(monitor);
+ result = n;
+ }
+ int get_result()
+ {
+ boost::mutex::scoped_lock lock(monitor);
+ return result;
+ }
static void deleter(state * p) { delete p; }
private:
- ~state() {}
- boost::mutex monitor;
- int result;
+ ~state() {}
+ boost::mutex monitor;
+ int result;
};
// The conventional tss pointer.
@@ -69,12 +69,12 @@
void init_state_fn()
{
{
- boost::mutex::scoped_lock out_guard(out_global_mutex);
- std::cout << "init_state_fn" << " " << boost::this_thread::get_id()<<std::endl;
+ boost::mutex::scoped_lock out_guard(out_global_mutex);
+ std::cout << "init_state_fn" << " " << boost::this_thread::get_id()<<std::endl;
}
- public_state.reset(new state(), state::deleter);
- private_int.reset(new int(0));
+ public_state.reset(new state(), state::deleter);
+ private_int.reset(new int(0));
}
boost::interthreads::thread_decoration init_state(init_state_fn);
@@ -83,69 +83,69 @@
void run()
{
init_state_fn();
- sleep(2);
+ sleep(2);
{
- boost::mutex::scoped_lock out_guard(out_global_mutex);
- std::cout << "run " << " " << boost::this_thread::get_id()<<std::endl;
+ boost::mutex::scoped_lock out_guard(out_global_mutex);
+ std::cout << "run " << " " << boost::this_thread::get_id()<<std::endl;
}
- public_state->set_result(42);
-
- boost::shared_ptr<state> ths = public_state[boost::this_thread::get_id()];
+ public_state->set_result(42);
+
+ boost::shared_ptr<state> ths = public_state[boost::this_thread::get_id()];
int result;
- result = ths->get_result();
+ result = ths->get_result();
{
- boost::mutex::scoped_lock out_guard(out_global_mutex);
- std::cout << "ahead " << result << " " << boost::this_thread::get_id()<<std::endl;
+ boost::mutex::scoped_lock out_guard(out_global_mutex);
+ std::cout << "ahead " << result << " " << boost::this_thread::get_id()<<std::endl;
}
- sleep(2);
-
+ sleep(2);
+
}
int main(int argc, char* argv[])
{
int result;
- boost::thread* th = new boost::thread(boost::interthreads::make_decorator(run));
+ boost::thread* th = new boost::thread(boost::interthreads::make_decorator(run));
const boost::shared_ptr<state> ths = public_state.wait_and_get(th->get_id());
if (ths.get()!=0) {
- result = ths->get_result();
+ result = ths->get_result();
{
- boost::mutex::scoped_lock out_guard(out_global_mutex);
- std::cout << "ahead " << result << " " << boost::this_thread::get_id()<<std::endl;
+ boost::mutex::scoped_lock out_guard(out_global_mutex);
+ std::cout << "ahead " << result << " " << boost::this_thread::get_id()<<std::endl;
}
}
- private_int.reset(new int(0));
- ths->set_result(1111);
+ private_int.reset(new int(0));
+ ths->set_result(1111);
if (ths.get()!=0) {
- result = ths->get_result();
+ result = ths->get_result();
{
- boost::mutex::scoped_lock out_guard(out_global_mutex);
- std::cout << "ahead " << result << " " << boost::this_thread::get_id()<<std::endl;
+ boost::mutex::scoped_lock out_guard(out_global_mutex);
+ std::cout << "ahead " << result << " " << boost::this_thread::get_id()<<std::endl;
}
}
-
+
sleep(2);
- boost::shared_ptr<state> ths3 = public_state[th->get_id()];
+ boost::shared_ptr<state> ths3 = public_state[th->get_id()];
if (ths.get()!=0) {
- result = ths->get_result();
+ result = ths->get_result();
{
- boost::mutex::scoped_lock out_guard(out_global_mutex);
- std::cout << "ahead " << result << " " << boost::this_thread::get_id()<<std::endl;
+ boost::mutex::scoped_lock out_guard(out_global_mutex);
+ std::cout << "ahead " << result << " " << boost::this_thread::get_id()<<std::endl;
}
}
- th->join();
+ th->join();
- delete th;
+ delete th;
- // We still may access the state object by means of the shared_ptr.
+ // We still may access the state object by means of the shared_ptr.
if (ths.get()!=0) {
- result = ths->get_result();
+ result = ths->get_result();
{
- boost::mutex::scoped_lock out_guard(out_global_mutex);
- std::cout << "ahead " << result << " " << boost::this_thread::get_id()<<std::endl;
+ boost::mutex::scoped_lock out_guard(out_global_mutex);
+ std::cout << "ahead " << result << " " << boost::this_thread::get_id()<<std::endl;
}
}
const boost::shared_ptr<state> cths(new state(), state::deleter);
@@ -154,6 +154,6 @@
boost::mutex::scoped_lock out_guard(out_global_mutex);
std::cout << "xxx" << cths->get_result() << " " << boost::this_thread::get_id()<<std::endl;
}
- return 0;
+ return 0;
}
Modified: sandbox/interthreads/libs/interthreads/test/test_threader.cpp
==============================================================================
--- sandbox/interthreads/libs/interthreads/test/test_threader.cpp (original)
+++ sandbox/interthreads/libs/interthreads/test/test_threader.cpp 2009-02-08 16:09:39 EST (Sun, 08 Feb 2009)
@@ -1,13 +1,13 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Vicente J. Botet Escriba 2008-20009. Distributed under the Boost
+// (C) Copyright Vicente J. Botet Escriba 2008-2009. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/sync for documentation.
//
//////////////////////////////////////////////////////////////////////////////
-
+
#include "boost/thread/mutex.hpp"
#include "boost/thread/locks.hpp"
@@ -36,30 +36,37 @@
aetst::do_test_member_fork_detach(ae);
}
-void do_test_member_fork() {
+void do_test_member_fork() {
bith::shared_threader ae;
aetst::do_test_member_fork(ae);
-}
+}
+
+#if 0
+void do_test_member_lazy_fork() {
+ bith::shared_threader ae;
+ aetst::do_test_member_lazy_fork(ae);
+}
+#endif
void do_test_member_fork_move_unique() {
bith::unique_threader ae;
- aetst::do_test_member_fork_move(ae);
+ aetst::do_test_member_fork_m_fut(ae);
}
void do_test_member_fork_bind() {
bith::shared_threader ae;
aetst::do_test_member_fork_bind(ae);
-}
+}
void do_test_fork() {
bith::shared_threader ae;
aetst::do_test_fork(ae);
-}
+}
void do_test_fork_1() {
bith::shared_threader ae;
aetst::do_test_fork_1(ae);
-}
+}
void do_test_creation_through_reference_wrapper()
{
@@ -73,20 +80,72 @@
aetst::do_test_creation_through_functor(ae);
}
+void do_test_wait() {
+ bith::shared_threader ae;
+ aetst::do_test_wait(ae);
+}
+
+void do_test_wait_until() {
+ bith::shared_threader ae;
+ aetst::do_test_wait_until(ae);
+}
+
+void do_test_wait_for() {
+ bith::shared_threader ae;
+ aetst::do_test_wait_for(ae);
+}
+
+void do_test_join() {
+ bith::shared_threader ae;
+ aetst::do_test_join(ae);
+}
+
+void do_test_join_until() {
+ bith::shared_threader ae;
+ aetst::do_test_join_until(ae);
+}
+
+void do_test_join_for() {
+ bith::shared_threader ae;
+ aetst::do_test_join_for(ae);
+}
+
+
void do_test_thread_interrupts_at_interruption_point() {
bith::shared_threader ae;
aetst::do_test_thread_interrupts_at_interruption_point(ae);
-}
+}
void do_test_join_all() {
bith::shared_threader ae;
- aetst::do_test_join_all(ae);
+ aetst::do_test_join_all(ae);
+}
+
+void do_test_join_all_until() {
+ bith::shared_threader ae;
+ aetst::do_test_join_all_until(ae);
+}
+
+void do_test_join_all_for() {
+ bith::shared_threader ae;
+ aetst::do_test_join_all_for(ae);
}
+
void do_test_wait_all() {
bith::shared_threader ae;
aetst::do_test_wait_all(ae);
}
+void do_test_wait_all_until() {
+ bith::shared_threader ae;
+ aetst::do_test_wait_all_until(ae);
+}
+
+void do_test_wait_all_for() {
+ bith::shared_threader ae;
+ aetst::do_test_wait_all_for(ae);
+}
+
void do_test_wait_for_any() {
bith::shared_threader ae;
aetst::do_test_wait_for_any(ae);
@@ -115,24 +174,25 @@
{
typedef bith::shared_threader AE;
AE ae;
- typedef bith::result_of::fork_all<bith::shared_threader,bfus::tuple<int(*)(),std::string(*)()> >::type type;
+ typedef bith::result_of::fork_all<AE,bfus::tuple<int(*)(),std::string(*)()> >::type type;
type tple = bith::fork_all(ae, simple_thread, simple_string_thread);
unsigned r = my_wait_for_any<AE>(tple);
bith::interrupt_all(tple);
BOOST_CHECK_EQUAL(r, 0u);
+ boost::this_thread::sleep(boost::posix_time::milliseconds(5000));
+ std::cout << "<<do_test_wait_for_any_fusion_sequence" << std::endl;
+
+}
+
+void do_test_get() {
+ bith::shared_launcher ae;
+ aetst::do_test_get(ae);
}
-#if 0
void do_test_get_all() {
bith::shared_threader ae;
- typedef bith::result_of::fork_all<bith::shared_threader,bfus::tuple<int(*)(),int(*)()> >::type auto_type;
- //auto_type tple = bith::fork_all(ae, simple_thread, simple_thread);
- BOOST_AUTO(tple,bith::fork_all(ae, simple_thread, simple_thread));
- bith::wait_all(tple);
- BOOST_AUTO(res,bith::get_all(tple));
- //bfus::for_each(res, print_xml());
+ aetst::do_test_set_all(ae);
}
-#endif
void do_test_set_all() {
bith::shared_threader ae;
@@ -144,22 +204,22 @@
aetst::do_test_wait_for_all(ae);
}
-void do_test_fork_after_join() {
+void do_test_fork_after_join() {
bith::shared_threader ae;
aetst::do_test_fork_after_join(ae);
-}
+}
-void do_test_fork_after_wait() {
+void do_test_fork_after_wait() {
bith::shared_threader ae;
aetst::do_test_fork_after_wait(ae);
-}
+}
-void do_test_fork_after_get() {
+void do_test_fork_after_get() {
bith::shared_threader ae;
aetst::do_test_fork_after_get(ae);
-}
+}
-void do_test_other() {
+void do_test_other() {
boost::mutex mtx_;
int i=0;
for (boost::mutex::scoped_lock lock_(mtx_), *continue_hlp_,**continue_=&continue_hlp_; continue_; continue_=0) {
@@ -176,34 +236,51 @@
i++;
}
BOOST_CHECK_EQUAL(i, 3);
-}
+}
test_suite* init_unit_test_suite(int, char*[])
{
test_suite* test = BOOST_TEST_SUITE("shared_threader");
-
- test->add(BOOST_TEST_CASE(&do_test_member_fork_detach));
+
+
test->add(BOOST_TEST_CASE(&do_test_member_fork));
test->add(BOOST_TEST_CASE(&do_test_member_fork_bind));
test->add(BOOST_TEST_CASE(&do_test_fork));
test->add(BOOST_TEST_CASE(&do_test_fork_1));
- test->add(BOOST_TEST_CASE(&do_test_thread_interrupts_at_interruption_point));
test->add(BOOST_TEST_CASE(&do_test_creation_through_functor));
test->add(BOOST_TEST_CASE(&do_test_creation_through_reference_wrapper));
-
+
+ test->add(BOOST_TEST_CASE(&do_test_get));
+ test->add(BOOST_TEST_CASE(&do_test_wait));
+ test->add(BOOST_TEST_CASE(&do_test_wait_until));
+ test->add(BOOST_TEST_CASE(&do_test_wait_for));
+
test->add(BOOST_TEST_CASE(&do_test_wait_all));
- test->add(BOOST_TEST_CASE(&do_test_join_all));
- test->add(BOOST_TEST_CASE(&do_test_wait_for_any));
+ test->add(BOOST_TEST_CASE(&do_test_wait_all_until));
+ test->add(BOOST_TEST_CASE(&do_test_wait_all_for));
test->add(BOOST_TEST_CASE(&do_test_set_all));
+ test->add(BOOST_TEST_CASE(&do_test_get_all));
+ test->add(BOOST_TEST_CASE(&do_test_member_fork_detach));
+ test->add(BOOST_TEST_CASE(&do_test_thread_interrupts_at_interruption_point));
+ test->add(BOOST_TEST_CASE(&do_test_join));
+ test->add(BOOST_TEST_CASE(&do_test_join_until));
+ test->add(BOOST_TEST_CASE(&do_test_join_for));
+ test->add(BOOST_TEST_CASE(&do_test_join_all));
+ test->add(BOOST_TEST_CASE(&do_test_join_all_until));
+ test->add(BOOST_TEST_CASE(&do_test_join_all_for));
test->add(BOOST_TEST_CASE(&do_test_wait_for_all));
+ test->add(BOOST_TEST_CASE(&do_test_wait_for_any));
+ test->add(BOOST_TEST_CASE(&do_test_wait_for_any_fusion_sequence));
test->add(BOOST_TEST_CASE(&do_test_fork_after_join));
test->add(BOOST_TEST_CASE(&do_test_fork_after_wait));
test->add(BOOST_TEST_CASE(&do_test_fork_after_get));
- test->add(BOOST_TEST_CASE(&do_test_wait_for_any_fusion_sequence));
- #if 0
+#if 0
+ test->add(BOOST_TEST_CASE(&do_test_member_lazy_fork));
test->add(BOOST_TEST_CASE(&do_test_other));
- test->add(BOOST_TEST_CASE(&do_test_get_all));
- #endif
+ test_suite* test = BOOST_TEST_SUITE("unique_threader");
+
+ test->add(BOOST_TEST_CASE(&do_test_member_fork_move_unique));
+#endif
return test;
}
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