|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r52460 - in sandbox/task: boost/task libs/task/examples libs/task/test
From: oliver.kowalke_at_[hidden]
Date: 2009-04-18 02:32:10
Author: olli
Date: 2009-04-18 02:32:08 EDT (Sat, 18 Apr 2009)
New Revision: 52460
URL: http://svn.boost.org/trac/boost/changeset/52460
Log:
* rename launch_in_pool() into launch()
* removed launch_in_thread() and launch_in_current()
Text files modified:
sandbox/task/boost/task/launch.hpp | 19 ++++---------------
sandbox/task/libs/task/examples/bind_to_processors.cpp | 6 +++---
sandbox/task/libs/task/examples/delay.cpp | 6 +++---
sandbox/task/libs/task/examples/fork_join.cpp | 6 +++---
sandbox/task/libs/task/examples/interrupt.cpp | 4 ++--
sandbox/task/libs/task/examples/pending.cpp | 4 ++--
sandbox/task/libs/task/examples/priority.cpp | 8 ++++----
sandbox/task/libs/task/examples/reschedule_until.cpp | 8 ++++----
sandbox/task/libs/task/examples/shutdonw_now.cpp | 2 +-
sandbox/task/libs/task/examples/smart.cpp | 8 ++++----
sandbox/task/libs/task/examples/submit.cpp | 10 ++--------
sandbox/task/libs/task/examples/yield.cpp | 10 +++++-----
sandbox/task/libs/task/test/test_launch.cpp | 34 +++++++++++-----------------------
13 files changed, 48 insertions(+), 77 deletions(-)
Modified: sandbox/task/boost/task/launch.hpp
==============================================================================
--- sandbox/task/boost/task/launch.hpp (original)
+++ sandbox/task/boost/task/launch.hpp 2009-04-18 02:32:08 EDT (Sat, 18 Apr 2009)
@@ -14,14 +14,14 @@
namespace boost { namespace task
{
template< typename R >
-void launch_in_pool( task< R > t)
+void launch( task< R > t)
{ get_default_pool().submit( t); }
template<
typename R,
typename Attr
>
-void launch_in_pool(
+void launch(
task< R > t,
Attr const& attr)
{ get_default_pool().submit( t, attr); }
@@ -30,7 +30,7 @@
typename Channel,
typename R
>
-void launch_in_pool(
+void launch(
pool< Channel > & pool,
task< R > t)
{ pool.submit( t); }
@@ -40,22 +40,11 @@
typename R,
typename Attr
>
-void launch_in_pool(
+void launch(
pool< Channel > & pool,
task< R > t,
Attr const& attr)
{ pool.submit( t, attr); }
-
-template< typename R >
-void launch_in_thread( task< R > t)
-{
- thread th( t);
- th.join();
-}
-
-template< typename R >
-void launch_in_current( task< R > t)
-{ t(); }
} }
#endif // BOOST_TASK_LAUNCH_H
Modified: sandbox/task/libs/task/examples/bind_to_processors.cpp
==============================================================================
--- sandbox/task/libs/task/examples/bind_to_processors.cpp (original)
+++ sandbox/task/libs/task/examples/bind_to_processors.cpp 2009-04-18 02:32:08 EDT (Sat, 18 Apr 2009)
@@ -52,10 +52,10 @@
& fib_task::execute,
boost::ref( * this),
n - 2) );
- tsk::launch_in_pool(
+ tsk::launch(
boost::this_task::get_pool< pool_type >(),
t1);
- tsk::launch_in_pool(
+ tsk::launch(
boost::this_task::get_pool< pool_type >(),
t2);
return t1.get() + t2.get();
@@ -88,7 +88,7 @@
& parallel_fib,
i) );
results.push_back( t);
- tsk::launch_in_pool( pool, t);
+ tsk::launch( pool, t);
}
tsk::waitfor_all( results.begin(), results.end() );
Modified: sandbox/task/libs/task/examples/delay.cpp
==============================================================================
--- sandbox/task/libs/task/examples/delay.cpp (original)
+++ sandbox/task/libs/task/examples/delay.cpp 2009-04-18 02:32:08 EDT (Sat, 18 Apr 2009)
@@ -55,8 +55,8 @@
& fib_task::execute,
boost::ref( * this),
n - 2) );
- tsk::launch_in_pool( t1);
- tsk::launch_in_pool( t2);
+ tsk::launch( t1);
+ tsk::launch( t2);
return t1.get() + t2.get();
}
}
@@ -75,7 +75,7 @@
try
{
for ( int i = 0; i < 10; ++i)
- tsk::launch_in_pool(
+ tsk::launch(
tsk::make_task(
& parallel_fib,
i) );
Modified: sandbox/task/libs/task/examples/fork_join.cpp
==============================================================================
--- sandbox/task/libs/task/examples/fork_join.cpp (original)
+++ sandbox/task/libs/task/examples/fork_join.cpp 2009-04-18 02:32:08 EDT (Sat, 18 Apr 2009)
@@ -52,10 +52,10 @@
& fib_task::execute,
boost::ref( * this),
n - 2) );
- tsk::launch_in_pool(
+ tsk::launch(
boost::this_task::get_pool< pool_type >(),
t1);
- tsk::launch_in_pool(
+ tsk::launch(
boost::this_task::get_pool< pool_type >(),
t2);
return t1.get() + t2.get();
@@ -87,7 +87,7 @@
& parallel_fib,
i) );
results.push_back( t);
- tsk::launch_in_pool( pool, t);
+ tsk::launch( pool, t);
}
tsk::waitfor_all( results.begin(), results.end() );
Modified: sandbox/task/libs/task/examples/interrupt.cpp
==============================================================================
--- sandbox/task/libs/task/examples/interrupt.cpp (original)
+++ sandbox/task/libs/task/examples/interrupt.cpp 2009-04-18 02:32:08 EDT (Sat, 18 Apr 2009)
@@ -42,7 +42,7 @@
{
try
{
- tsk::launch_in_pool(
+ tsk::launch(
tsk::make_task(
long_running_fn) );
std::cout << "poolsize == " << tsk::get_default_pool().size() << std::endl;
@@ -52,7 +52,7 @@
tsk::make_task(
fibonacci_fn,
10) );
- tsk::launch_in_pool( t);
+ tsk::launch( t);
t.interrupt();
std::cout << t.get() << std::endl;
Modified: sandbox/task/libs/task/examples/pending.cpp
==============================================================================
--- sandbox/task/libs/task/examples/pending.cpp (original)
+++ sandbox/task/libs/task/examples/pending.cpp 2009-04-18 02:32:08 EDT (Sat, 18 Apr 2009)
@@ -47,10 +47,10 @@
tsk::make_task(
fibonacci_fn,
10) );
- tsk::launch_in_pool(
+ tsk::launch(
tsk::make_task(
long_running_fn) );
- tsk::launch_in_pool( t);
+ tsk::launch( t);
std::cout << "pending tasks == " << tsk::get_default_pool().pending() << std::endl;
std::cout << t.get() << std::endl;
Modified: sandbox/task/libs/task/examples/priority.cpp
==============================================================================
--- sandbox/task/libs/task/examples/priority.cpp (original)
+++ sandbox/task/libs/task/examples/priority.cpp 2009-04-18 02:32:08 EDT (Sat, 18 Apr 2009)
@@ -33,24 +33,24 @@
tsk::unbounded_channel< tsk::priority< int > >
> pool( tsk::poolsize( 1) );
- tsk::launch_in_pool(
+ tsk::launch(
pool,
tsk::make_task(
long_running_fn),
0);
- tsk::launch_in_pool(
+ tsk::launch(
pool,
tsk::make_task(
print_fn,
"This"),
0);
- tsk::launch_in_pool(
+ tsk::launch(
pool,
tsk::make_task(
print_fn,
"a text.\n"),
2);
- tsk::launch_in_pool(
+ tsk::launch(
pool,
tsk::make_task(
print_fn,
Modified: sandbox/task/libs/task/examples/reschedule_until.cpp
==============================================================================
--- sandbox/task/libs/task/examples/reschedule_until.cpp (original)
+++ sandbox/task/libs/task/examples/reschedule_until.cpp 2009-04-18 02:32:08 EDT (Sat, 18 Apr 2009)
@@ -61,8 +61,8 @@
& fib_task::execute,
boost::ref( * this),
n - 2) );
- tsk::launch_in_pool( t1);
- tsk::launch_in_pool( t2);
+ tsk::launch( t1);
+ tsk::launch( t2);
return t1.get() + t2.get();
}
}
@@ -140,7 +140,7 @@
int fd[2];
create_sockets( fd);
- tsk::launch_in_pool(
+ tsk::launch(
tsk::make_task(
& do_read,
fd[0]) );
@@ -149,7 +149,7 @@
boost::this_thread::sleep( pt::seconds( 1) );
for ( int i = 0; i < 15; ++i)
- tsk::launch_in_pool(
+ tsk::launch(
tsk::make_task(
& parallel_fib,
i) );
Modified: sandbox/task/libs/task/examples/shutdonw_now.cpp
==============================================================================
--- sandbox/task/libs/task/examples/shutdonw_now.cpp (original)
+++ sandbox/task/libs/task/examples/shutdonw_now.cpp 2009-04-18 02:32:08 EDT (Sat, 18 Apr 2009)
@@ -48,7 +48,7 @@
tsk::make_task(
fibonacci_fn,
10) );
- tsk::launch_in_pool( pool, t);
+ tsk::launch( pool, t);
boost::this_thread::sleep( pt::milliseconds( 250) );
Modified: sandbox/task/libs/task/examples/smart.cpp
==============================================================================
--- sandbox/task/libs/task/examples/smart.cpp (original)
+++ sandbox/task/libs/task/examples/smart.cpp 2009-04-18 02:32:08 EDT (Sat, 18 Apr 2009)
@@ -59,24 +59,24 @@
>
> pool( tsk::poolsize( 1) );
- tsk::launch_in_pool(
+ tsk::launch(
pool,
tsk::make_task(
long_running_fn),
0);
- tsk::launch_in_pool(
+ tsk::launch(
pool,
tsk::make_task(
fibonacci_fn,
0),
1);
- tsk::launch_in_pool(
+ tsk::launch(
pool,
tsk::make_task(
fibonacci_fn,
1),
2);
- tsk::launch_in_pool(
+ tsk::launch(
pool,
tsk::make_task(
fibonacci_fn,
Modified: sandbox/task/libs/task/examples/submit.cpp
==============================================================================
--- sandbox/task/libs/task/examples/submit.cpp (original)
+++ sandbox/task/libs/task/examples/submit.cpp 2009-04-18 02:32:08 EDT (Sat, 18 Apr 2009)
@@ -43,16 +43,10 @@
tsk::make_task(
fibonacci_fn,
10) );
- tsk::task< int > t3(
- tsk::make_task(
- fibonacci_fn,
- 10) );
- tsk::launch_in_pool( t1);
- tsk::launch_in_thread( t2);
- tsk::launch_in_current( t3);
+ tsk::launch( t1);
+ t2();
std::cout << t1.get() << std::endl;
std::cout << t2.get() << std::endl;
- std::cout << t3.get() << std::endl;
return EXIT_SUCCESS;
}
Modified: sandbox/task/libs/task/examples/yield.cpp
==============================================================================
--- sandbox/task/libs/task/examples/yield.cpp (original)
+++ sandbox/task/libs/task/examples/yield.cpp 2009-04-18 02:32:08 EDT (Sat, 18 Apr 2009)
@@ -58,13 +58,13 @@
n - 2) );
if ( boost::this_task::runs_in_pool() )
{
- tsk::launch_in_pool( t1);
- tsk::launch_in_pool( t2);
+ tsk::launch( t1);
+ tsk::launch( t2);
}
else
{
- tsk::launch_in_thread( t1);
- tsk::launch_in_thread( t2);
+ t1();
+ t2();
}
return t1.get() + t2.get();
}
@@ -84,7 +84,7 @@
try
{
for ( int i = 0; i < 10; ++i)
- tsk::launch_in_pool(
+ tsk::launch(
tsk::make_task(
& parallel_fib,
i) );
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-18 02:32:08 EDT (Sat, 18 Apr 2009)
@@ -36,7 +36,7 @@
tsk::make_task(
fibonacci_fn,
10) );
- tsk::launch_in_pool( t);
+ tsk::launch( t);
BOOST_CHECK_EQUAL( t.get(), 55);
}
@@ -50,42 +50,31 @@
tsk::make_task(
fibonacci_fn,
10) );
- tsk::launch_in_pool( pool, t);
- BOOST_CHECK_EQUAL( t.get(), 55);
- }
-
- // launch in new thread
- void test_case_3()
- {
- tsk::task< int > t(
- tsk::make_task(
- fibonacci_fn,
- 10) );
- tsk::launch_in_thread( t);
+ tsk::launch( pool, t);
BOOST_CHECK_EQUAL( t.get(), 55);
}
// launch in current thread
- void test_case_4()
+ void test_case_3()
{
tsk::task< int > t(
tsk::make_task(
fibonacci_fn,
10) );
- tsk::launch_in_current( t);
+ t();
BOOST_CHECK_EQUAL( t.get(), 55);
}
// don't execute twice
- void test_case_5()
+ void test_case_4()
{
tsk::task< int > t(
tsk::make_task(
fibonacci_fn,
10) );
- tsk::launch_in_current( t);
+ t();
BOOST_CHECK_EQUAL( t.get(), 55);
- tsk::launch_in_current( t);
+ t();
bool thrown( false);
try
{ t.get(); }
@@ -95,22 +84,22 @@
}
// check runs in pool
- void test_case_6()
+ void test_case_5()
{
tsk::task< bool > t(
tsk::make_task(
runs_in_pool_fn) );
- tsk::launch_in_pool( t);
+ tsk::launch( t);
BOOST_CHECK_EQUAL( t.get(), true);
}
// check runs not in pool
- void test_case_7()
+ void test_case_6()
{
tsk::task< bool > t(
tsk::make_task(
runs_in_pool_fn) );
- tsk::launch_in_thread( t);
+ t();
BOOST_CHECK_EQUAL( t.get(), false);
}
};
@@ -126,7 +115,6 @@
test->add( BOOST_CLASS_TEST_CASE( & test_launch::test_case_4, instance) );
test->add( BOOST_CLASS_TEST_CASE( & test_launch::test_case_5, instance) );
test->add( BOOST_CLASS_TEST_CASE( & test_launch::test_case_6, instance) );
- test->add( BOOST_CLASS_TEST_CASE( & test_launch::test_case_7, instance) );
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