|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r52569 - in sandbox/task: boost/task boost/task/detail libs/task/src libs/task/test
From: oliver.kowalke_at_[hidden]
Date: 2009-04-23 14:34:04
Author: olli
Date: 2009-04-23 14:34:02 EDT (Thu, 23 Apr 2009)
New Revision: 52569
URL: http://svn.boost.org/trac/boost/changeset/52569
Log:
* introduction of class id
* tests added
Added:
sandbox/task/libs/task/test/test_handle.cpp (contents, props changed)
Text files modified:
sandbox/task/boost/task/detail/callable.hpp | 6
sandbox/task/boost/task/detail/worker.hpp | 2
sandbox/task/boost/task/handle.hpp | 36 +++++++++
sandbox/task/libs/task/src/callable.cpp | 4
sandbox/task/libs/task/test/Jamfile.v2 | 5
sandbox/task/libs/task/test/test_launch.cpp | 27 ++++---
sandbox/task/libs/task/test/test_pool_bounded_channel.cpp | 140 +++++++++++++++++++++---------------
sandbox/task/libs/task/test/test_pool_unbounded_channel.cpp | 150 ++++++++++++++++++++++-----------------
8 files changed, 228 insertions(+), 142 deletions(-)
Modified: sandbox/task/boost/task/detail/callable.hpp
==============================================================================
--- sandbox/task/boost/task/detail/callable.hpp (original)
+++ sandbox/task/boost/task/detail/callable.hpp 2009-04-23 14:34:02 EDT (Thu, 23 Apr 2009)
@@ -55,15 +55,15 @@
shared_ptr< impl > impl_;
public:
- class scoped_lock : public noncopyable
+ class scoped_guard : public noncopyable
{
private:
callable & ca_;
public:
- scoped_lock( callable &, shared_ptr< thread > &);
+ scoped_guard( callable &, shared_ptr< thread > &);
- ~scoped_lock();
+ ~scoped_guard();
};
callable();
Modified: sandbox/task/boost/task/detail/worker.hpp
==============================================================================
--- sandbox/task/boost/task/detail/worker.hpp (original)
+++ sandbox/task/boost/task/detail/worker.hpp 2009-04-23 14:34:02 EDT (Thu, 23 Apr 2009)
@@ -102,7 +102,7 @@
BOOST_ASSERT( ! ca.empty() );
guard grd( get_pool().active_worker_);
{
- callable::scoped_lock lk( ca, thrd_);
+ callable::scoped_guard lk( ca, thrd_);
ca();
}
ca.clear();
Modified: sandbox/task/boost/task/handle.hpp
==============================================================================
--- sandbox/task/boost/task/handle.hpp (original)
+++ sandbox/task/boost/task/handle.hpp 2009-04-23 14:34:02 EDT (Thu, 23 Apr 2009)
@@ -118,6 +118,24 @@
intr_.swap( other.intr_);
id_.swap( other.id_);
}
+
+ bool operator==( handle< R > const& other) const
+ { return id_ == other.id_; }
+
+ bool operator!=( handle< R > const& other) const
+ { return id_ != other.id_; }
+
+ bool operator<( handle< R > const& other) const
+ { return id_ < other.id_; }
+
+ bool operator>( handle< R > const& other) const
+ { return id_ > other.id_; }
+
+ bool operator<=( handle< R > const& other) const
+ { return id_ <= other.id_; }
+
+ bool operator>=( handle< R > const& other) const
+ { return id_ >= other.id_; }
};
template<>
@@ -218,6 +236,24 @@
fut_.swap( other.fut_);
intr_.swap( other.intr_);
}
+
+ bool operator==( handle< void > const& other) const
+ { return id_ == other.id_; }
+
+ bool operator!=( handle< void > const& other) const
+ { return id_ != other.id_; }
+
+ bool operator<( handle< void > const& other) const
+ { return id_ < other.id_; }
+
+ bool operator>( handle< void > const& other) const
+ { return id_ > other.id_; }
+
+ bool operator<=( handle< void > const& other) const
+ { return id_ <= other.id_; }
+
+ bool operator>=( handle< void > const& other) const
+ { return id_ >= other.id_; }
};
template< typename Iterator >
Modified: sandbox/task/libs/task/src/callable.cpp
==============================================================================
--- sandbox/task/libs/task/src/callable.cpp (original)
+++ sandbox/task/libs/task/src/callable.cpp 2009-04-23 14:34:02 EDT (Thu, 23 Apr 2009)
@@ -26,11 +26,11 @@
callable::clear()
{ impl_.reset(); }
-callable::scoped_lock::scoped_lock( callable & ca, shared_ptr< thread > & thrd)
+callable::scoped_guard::scoped_guard( callable & ca, shared_ptr< thread > & thrd)
: ca_( ca)
{ ca_.impl_->set( thrd); }
-callable::scoped_lock::~scoped_lock()
+callable::scoped_guard::~scoped_guard()
{ ca_.impl_->reset(); }
} } }
Modified: sandbox/task/libs/task/test/Jamfile.v2
==============================================================================
--- sandbox/task/libs/task/test/Jamfile.v2 (original)
+++ sandbox/task/libs/task/test/Jamfile.v2 2009-04-23 14:34:02 EDT (Thu, 23 Apr 2009)
@@ -27,7 +27,8 @@
}
test-suite thread_pool :
- [ tp-test test_pool_bounded_channel ]
- [ tp-test test_pool_unbounded_channel ]
+ [ tp-test test_handle ]
[ tp-test test_launch ]
+ [ tp-test test_pool_unbounded_channel ]
+ [ tp-test test_pool_bounded_channel ]
;
Added: sandbox/task/libs/task/test/test_handle.cpp
==============================================================================
--- (empty file)
+++ sandbox/task/libs/task/test/test_handle.cpp 2009-04-23 14:34:02 EDT (Thu, 23 Apr 2009)
@@ -0,0 +1,71 @@
+
+// Copyright Oliver Kowalke 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)
+
+#include <cstdlib>
+#include <iostream>
+#include <map>
+#include <stdexcept>
+#include <vector>
+
+#include <boost/bind.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/function.hpp>
+#include <boost/ref.hpp>
+#include <boost/test/unit_test.hpp>
+#include <boost/thread.hpp>
+#include <boost/thread/barrier.hpp>
+#include <boost/utility.hpp>
+
+#include <boost/task.hpp>
+
+#include "test_functions.hpp"
+
+namespace pt = boost::posix_time;
+namespace tsk = boost::task;
+
+class test_handle
+{
+public:
+ // test id
+ void test_case_1()
+ {
+ tsk::task< int > t(
+ tsk::make_task(
+ fibonacci_fn,
+ 10) );
+ tsk::handle< int > h( t.get_handle() );
+ tsk::launch( t);
+ BOOST_CHECK_EQUAL( t.get_id(), h.get_id() );
+ BOOST_CHECK_EQUAL( h.get(), 55);
+ }
+
+ // test handle
+ void test_case_2()
+ {
+ tsk::task< int > t(
+ tsk::make_task(
+ fibonacci_fn,
+ 10) );
+ tsk::handle< int > h1( t.get_handle() );
+ tsk::handle< int > h2( t.get_handle() );
+ tsk::launch( t);
+ BOOST_CHECK_EQUAL( t.get_id(), h1.get_id() );
+ BOOST_CHECK_EQUAL( t.get_id(), h2.get_id() );
+ BOOST_CHECK_EQUAL( h1.get_id(), h2.get_id() );
+ BOOST_CHECK_EQUAL( h1 == h2, true);
+ }
+};
+
+boost::unit_test::test_suite * init_unit_test_suite( int, char* [])
+{
+ boost::unit_test::test_suite * test( BOOST_TEST_SUITE("Boost.Task: test suite") );
+
+ boost::shared_ptr< test_handle > instance( new test_handle() );
+ test->add( BOOST_CLASS_TEST_CASE( & test_handle::test_case_1, instance) );
+ test->add( BOOST_CLASS_TEST_CASE( & test_handle::test_case_2, instance) );
+
+ return test;
+}
Modified: sandbox/task/libs/task/test/test_launch.cpp
==============================================================================
--- sandbox/task/libs/task/test/test_launch.cpp (original)
+++ sandbox/task/libs/task/test/test_launch.cpp 2009-04-23 14:34:02 EDT (Thu, 23 Apr 2009)
@@ -63,7 +63,8 @@
fibonacci_fn,
10) );
t();
- BOOST_CHECK_EQUAL( t.get(), 55);
+ tsk::handle< int > h( t.get_handle() );
+ BOOST_CHECK_EQUAL( h.get(), 55);
}
// don't execute twice
@@ -73,15 +74,16 @@
tsk::make_task(
fibonacci_fn,
10) );
- t();
- BOOST_CHECK_EQUAL( t.get(), 55);
- t();
- bool thrown( false);
- try
- { t.get(); }
- catch ( tsk::task_already_executed const&)
- { thrown = true; }
- BOOST_CHECK( thrown);
+ tsk::handle< int > h( t.get_handle() );
+ tsk::launch( t);
+ BOOST_CHECK_EQUAL( h.get(), 55);
+// tsk::launch( t);
+// bool thrown( false);
+// try
+// { h.get(); }
+// catch ( tsk::task_already_executed const&)
+// { thrown = true; }
+// BOOST_CHECK( thrown);
}
// check runs in pool
@@ -101,13 +103,14 @@
tsk::make_task(
runs_in_pool_fn) );
t();
- BOOST_CHECK_EQUAL( t.get(), false);
+ tsk::handle< bool > h( t.get_handle() );
+ BOOST_CHECK_EQUAL( h.get(), false);
}
};
boost::unit_test::test_suite * init_unit_test_suite( int, char* [])
{
- boost::unit_test::test_suite * test( BOOST_TEST_SUITE("Boost.ThreadPool: pool (with unbounded channel) test suite") );
+ boost::unit_test::test_suite * test( BOOST_TEST_SUITE("Boost.Task: test suite") );
boost::shared_ptr< test_launch > instance( new test_launch() );
test->add( BOOST_CLASS_TEST_CASE( & test_launch::test_case_1, instance) );
Modified: sandbox/task/libs/task/test/test_pool_bounded_channel.cpp
==============================================================================
--- sandbox/task/libs/task/test/test_pool_bounded_channel.cpp (original)
+++ sandbox/task/libs/task/test/test_pool_bounded_channel.cpp 2009-04-23 14:34:02 EDT (Thu, 23 Apr 2009)
@@ -53,10 +53,11 @@
tsk::high_watermark( 10),
tsk::low_watermark( 10) );
tsk::handle< int > h(
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
- fibonacci_fn,
- 10) ) );
+ fibonacci_fn,
+ 10) ) );
BOOST_CHECK_EQUAL( h.get(), 55);
}
@@ -70,7 +71,8 @@
tsk::high_watermark( 10),
tsk::low_watermark( 10) );
tsk::handle< int > h(
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
fibonacci_fn,
10) ) );
@@ -88,14 +90,15 @@
tsk::poolsize( 1),
tsk::high_watermark( 10),
tsk::low_watermark( 10) );
- tsk::task< void > t(
- tsk::make_task(
- throwing_fn) );
- pool.submit( t);
+ tsk::handle< void > h(
+ tsk::launch(
+ pool,
+ tsk::make_task(
+ throwing_fn) ) );
pool.shutdown();
bool thrown( false);
try
- { t.get(); }
+ { h.get(); }
catch ( std::runtime_error const&)
{ thrown = true; }
BOOST_CHECK( thrown);
@@ -115,7 +118,8 @@
bool thrown( false);
try
{
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
boost::bind(
fibonacci_fn,
@@ -135,11 +139,12 @@
tsk::poolsize( 1),
tsk::high_watermark( 1),
tsk::low_watermark( 1) );
- tsk::task< void > t(
- tsk::make_task(
- delay_fn,
- pt::millisec( 500) ) );
- pool.submit( t);
+ tsk::handle< void > h(
+ tsk::launch(
+ pool,
+ tsk::make_task(
+ delay_fn,
+ pt::millisec( 500) ) ) );
boost::this_thread::sleep( pt::millisec( 250) );
BOOST_CHECK_EQUAL( pool.size(), std::size_t( 1) );
pool.shutdown_now();
@@ -149,7 +154,7 @@
BOOST_CHECK_EQUAL( pool.active(), std::size_t( 0) );
bool thrown( false);
try
- { t.get(); }
+ { h.get(); }
catch ( tsk::task_interrupted const&)
{ thrown = true; }
BOOST_CHECK( thrown);
@@ -166,31 +171,34 @@
tsk::high_watermark( 10),
tsk::low_watermark( 10) );
boost::barrier b( 2);
- tsk::task< void > t1(
- tsk::make_task(
- barrier_fn,
- boost::ref( b) ) );
- pool.submit( t1);
+ tsk::handle< void > h1(
+ tsk::launch(
+ pool,
+ tsk::make_task(
+ barrier_fn,
+ boost::ref( b) ) ) );
boost::this_thread::sleep( pt::millisec( 250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 0) );
- tsk::task< int > t2(
- tsk::make_task(
- fibonacci_fn,
- 10) );
- pool.submit( t2);
+ tsk::handle< int > h2(
+ tsk::launch(
+ pool,
+ tsk::make_task(
+ fibonacci_fn,
+ 10) ) );
boost::this_thread::sleep( pt::millisec(250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 1) );
- tsk::task< int > t3(
- tsk::make_task(
- fibonacci_fn,
- 10) );
- pool.submit( t3);
+ tsk::handle< int > h3(
+ tsk::launch(
+ pool,
+ tsk::make_task(
+ fibonacci_fn,
+ 10) ) );
boost::this_thread::sleep( pt::millisec(250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 2) );
b.wait();
- t1.get();
- BOOST_CHECK_EQUAL( t2.get(), 55);
- BOOST_CHECK_EQUAL( t3.get(), 55);
+ h1.get();
+ BOOST_CHECK_EQUAL( h2.get(), 55);
+ BOOST_CHECK_EQUAL( h3.get(), 55);
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 0) );
}
@@ -205,30 +213,33 @@
tsk::high_watermark( 10),
tsk::low_watermark( 10) );
boost::barrier b( 2);
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
barrier_fn,
boost::ref( b) ) );
std::vector< int > buffer;
- tsk::task< void > t(
- tsk::make_task(
- buffer_fibonacci_fn,
- boost::ref( buffer),
- 10) );
- pool.submit( t);
- pool.submit(
+ tsk::handle< void > h(
+ tsk::launch(
+ pool,
+ tsk::make_task(
+ buffer_fibonacci_fn,
+ boost::ref( buffer),
+ 10) ) );
+ tsk::launch(
+ pool,
tsk::make_task(
buffer_fibonacci_fn,
boost::ref( buffer),
0) );
- t.interrupt();
+ h.interrupt();
b.wait();
pool.shutdown();
BOOST_CHECK_EQUAL( buffer[0], 0);
BOOST_CHECK_EQUAL( buffer.size(), std::size_t( 1) );
bool thrown( false);
try
- { t.get(); }
+ { h.get(); }
catch ( tsk::task_interrupted const&)
{ thrown = true; }
BOOST_CHECK( thrown);
@@ -245,17 +256,20 @@
tsk::high_watermark( 10),
tsk::low_watermark( 10) );
boost::barrier b( 2);
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
barrier_fn,
boost::ref( b) ) );
std::vector< int > buffer;
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
buffer_fibonacci_fn,
boost::ref( buffer),
10) );
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
buffer_fibonacci_fn,
boost::ref( buffer),
@@ -278,17 +292,20 @@
tsk::high_watermark( 10),
tsk::low_watermark( 10) );
boost::barrier b( 2);
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
barrier_fn,
boost::ref( b) ) );
std::vector< int > buffer;
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
buffer_fibonacci_fn,
boost::ref( buffer),
10) );
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
buffer_fibonacci_fn,
boost::ref( buffer),
@@ -311,19 +328,22 @@
tsk::high_watermark( 10),
tsk::low_watermark( 10) );
boost::barrier b( 2);
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
barrier_fn,
boost::ref( b) ),
0);
std::vector< int > buffer;
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
buffer_fibonacci_fn,
boost::ref( buffer),
10),
1);
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
buffer_fibonacci_fn,
boost::ref( buffer),
@@ -347,25 +367,29 @@
tsk::high_watermark( 10),
tsk::low_watermark( 10) );
boost::barrier b( 2);
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
barrier_fn,
boost::ref( b) ),
0);
std::vector< int > buffer;
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
buffer_fibonacci_fn,
boost::ref( buffer),
10),
2);
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
buffer_fibonacci_fn,
boost::ref( buffer),
0),
1);
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
buffer_fibonacci_fn,
boost::ref( buffer),
@@ -381,7 +405,7 @@
boost::unit_test::test_suite * init_unit_test_suite( int, char* [])
{
- boost::unit_test::test_suite * test( BOOST_TEST_SUITE("Boost.ThreadPool: pool (with bounded channel) test suite") );
+ boost::unit_test::test_suite * test( BOOST_TEST_SUITE("Boost.Task: test suite") );
boost::shared_ptr< test_pool_bounded_channel > instance( new test_pool_bounded_channel() );
test->add( BOOST_CLASS_TEST_CASE( & test_pool_bounded_channel::test_case_1, instance) );
Modified: sandbox/task/libs/task/test/test_pool_unbounded_channel.cpp
==============================================================================
--- sandbox/task/libs/task/test/test_pool_unbounded_channel.cpp (original)
+++ sandbox/task/libs/task/test/test_pool_unbounded_channel.cpp 2009-04-23 14:34:02 EDT (Thu, 23 Apr 2009)
@@ -46,12 +46,13 @@
tsk::pool<
tsk::unbounded_channel< tsk::fifo >
> pool( tsk::poolsize( 1) );
- tsk::task< int > t(
- tsk::make_task(
- fibonacci_fn,
- 10) );
- pool.submit( t);
- BOOST_CHECK_EQUAL( t.get(), 55);
+ tsk::handle< int > h(
+ tsk::launch(
+ pool,
+ tsk::make_task(
+ fibonacci_fn,
+ 10) ) );
+ BOOST_CHECK_EQUAL( h.get(), 55);
}
// check shutdown
@@ -60,14 +61,15 @@
tsk::pool<
tsk::unbounded_channel< tsk::fifo >
> pool( tsk::poolsize( 1) );
- tsk::task< int > t(
- tsk::make_task(
- fibonacci_fn,
- 10) );
- pool.submit( t);
+ tsk::handle< int > h(
+ tsk::launch(
+ pool,
+ tsk::make_task(
+ fibonacci_fn,
+ 10) ) );
pool.shutdown();
BOOST_CHECK( pool.closed() );
- BOOST_CHECK_EQUAL( t.get(), 55);
+ BOOST_CHECK_EQUAL( h.get(), 55);
}
// check runtime_error throw inside task
@@ -76,14 +78,15 @@
tsk::pool<
tsk::unbounded_channel< tsk::fifo >
> pool( tsk::poolsize( 1) );
- tsk::task< void > t(
- tsk::make_task(
- throwing_fn) );
- pool.submit( t);
+ tsk::handle< void > h(
+ tsk::launch(
+ pool,
+ tsk::make_task(
+ throwing_fn) ) );
pool.shutdown();
bool thrown( false);
try
- { t.get(); }
+ { h.get(); }
catch ( std::runtime_error const&)
{ thrown = true; }
BOOST_CHECK( thrown);
@@ -100,7 +103,8 @@
bool thrown( false);
try
{
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
boost::bind(
fibonacci_fn,
@@ -117,11 +121,12 @@
tsk::pool<
tsk::unbounded_channel< tsk::fifo >
> pool( tsk::poolsize( 1) );
- tsk::task< void > t(
- tsk::make_task(
- delay_fn,
- pt::millisec( 500) ) );
- pool.submit( t);
+ tsk::handle< void > h(
+ tsk::launch(
+ pool,
+ tsk::make_task(
+ delay_fn,
+ pt::millisec( 500) ) ) );
boost::this_thread::sleep( pt::millisec( 250) );
BOOST_CHECK_EQUAL( pool.size(), std::size_t( 1) );
pool.shutdown_now();
@@ -131,7 +136,7 @@
BOOST_CHECK_EQUAL( pool.active(), std::size_t( 0) );
bool thrown( false);
try
- { t.get(); }
+ { h.get(); }
catch ( tsk::task_interrupted const&)
{ thrown = true; }
BOOST_CHECK( thrown);
@@ -145,31 +150,34 @@
> pool_type;
pool_type pool( tsk::poolsize( 1) );
boost::barrier b( 2);
- tsk::task< void > t1(
- tsk::make_task(
- barrier_fn,
- boost::ref( b) ) );
- pool.submit( t1);
+ tsk::handle< void > h1(
+ tsk::launch(
+ pool,
+ tsk::make_task(
+ barrier_fn,
+ boost::ref( b) ) ) );
boost::this_thread::sleep( pt::millisec( 250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 0) );
- tsk::task< int > t2(
- tsk::make_task(
- fibonacci_fn,
- 10) );
- pool.submit( t2);
+ tsk::handle< int > h2(
+ tsk::launch(
+ pool,
+ tsk::make_task(
+ fibonacci_fn,
+ 10) ) );
boost::this_thread::sleep( pt::millisec(250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 1) );
- tsk::task< int > t3(
- tsk::make_task(
- fibonacci_fn,
- 10) );
- pool.submit( t3);
+ tsk::handle< int > h3(
+ tsk::launch(
+ pool,
+ tsk::make_task(
+ fibonacci_fn,
+ 10) ) );
boost::this_thread::sleep( pt::millisec(250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 2) );
b.wait();
- t1.get();
- BOOST_CHECK_EQUAL( t2.get(), 55);
- BOOST_CHECK_EQUAL( t3.get(), 55);
+ h1.get();
+ BOOST_CHECK_EQUAL( h2.get(), 55);
+ BOOST_CHECK_EQUAL( h3.get(), 55);
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 0) );
}
@@ -186,25 +194,27 @@
barrier_fn,
boost::ref( b) ) );
std::vector< int > buffer;
- tsk::task< void > t(
- tsk::make_task(
- buffer_fibonacci_fn,
- boost::ref( buffer),
- 10) );
- pool.submit( t);
- pool.submit(
+ tsk::handle< void > h(
+ tsk::launch(
+ pool,
+ tsk::make_task(
+ buffer_fibonacci_fn,
+ boost::ref( buffer),
+ 10) ) );
+ tsk::launch(
+ pool,
tsk::make_task(
buffer_fibonacci_fn,
boost::ref( buffer),
0) );
- t.interrupt();
+ h.interrupt();
b.wait();
pool.shutdown();
BOOST_CHECK_EQUAL( buffer[0], 0);
BOOST_CHECK_EQUAL( buffer.size(), std::size_t( 1) );
bool thrown( false);
try
- { t.get(); }
+ { h.get(); }
catch ( tsk::task_interrupted const&)
{ thrown = true; }
BOOST_CHECK( thrown);
@@ -218,17 +228,20 @@
> pool_type;
pool_type pool( tsk::poolsize( 1) );
boost::barrier b( 2);
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
barrier_fn,
boost::ref( b) ) );
std::vector< int > buffer;
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
buffer_fibonacci_fn,
boost::ref( buffer),
10) );
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
buffer_fibonacci_fn,
boost::ref( buffer),
@@ -248,17 +261,20 @@
> pool_type;
pool_type pool( tsk::poolsize( 1) );
boost::barrier b( 2);
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
barrier_fn,
boost::ref( b) ) );
std::vector< int > buffer;
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
buffer_fibonacci_fn,
boost::ref( buffer),
10) );
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
buffer_fibonacci_fn,
boost::ref( buffer),
@@ -278,19 +294,22 @@
> pool_type;
pool_type pool( tsk::poolsize( 1) );
boost::barrier b( 2);
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
barrier_fn,
boost::ref( b) ),
0);
std::vector< int > buffer;
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
buffer_fibonacci_fn,
boost::ref( buffer),
10),
1);
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
buffer_fibonacci_fn,
boost::ref( buffer),
@@ -317,19 +336,22 @@
boost::ref( b) ),
0);
std::vector< int > buffer;
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
buffer_fibonacci_fn,
boost::ref( buffer),
10),
2);
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
buffer_fibonacci_fn,
boost::ref( buffer),
0),
1);
- pool.submit(
+ tsk::launch(
+ pool,
tsk::make_task(
buffer_fibonacci_fn,
boost::ref( buffer),
@@ -345,7 +367,7 @@
boost::unit_test::test_suite * init_unit_test_suite( int, char* [])
{
- boost::unit_test::test_suite * test( BOOST_TEST_SUITE("Boost.ThreadPool: pool (with unbounded channel) test suite") );
+ boost::unit_test::test_suite * test( BOOST_TEST_SUITE("Boost.Task: test suite") );
boost::shared_ptr< test_pool_unbounded_channel > instance( new test_pool_unbounded_channel() );
test->add( BOOST_CLASS_TEST_CASE( & test_pool_unbounded_channel::test_case_1, instance) );
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