Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53642 - in sandbox/task: . boost boost/task boost/task/detail libs/task/examples libs/task/test
From: oliver.kowalke_at_[hidden]
Date: 2009-06-04 15:18:30


Author: olli
Date: 2009-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
New Revision: 53642
URL: http://svn.boost.org/trac/boost/changeset/53642

Log:
* async() with default as_sub_task
* detail/atomic.hpp with inline asm for x86 && powerpc

Added:
   sandbox/task/boost/task/as_sub_task.hpp (contents, props changed)
   sandbox/task/boost/task/new_thread.hpp (contents, props changed)
   sandbox/task/boost/task/own_thread.hpp (contents, props changed)
   sandbox/task/change.log (contents, props changed)
Removed:
   sandbox/task/boost/task/detail/platform.hpp
Text files modified:
   sandbox/task/boost/task.hpp | 3 +
   sandbox/task/boost/task/async.hpp | 94 +++------------------------------------
   sandbox/task/boost/task/detail/atomic_gcc.hpp | 5 +
   sandbox/task/boost/task/detail/atomic_gcc_ppc.hpp | 3 +
   sandbox/task/boost/task/detail/atomic_gcc_x86.hpp | 3 +
   sandbox/task/boost/task/detail/atomic_solaris.hpp | 1
   sandbox/task/boost/task/detail/bind_processor.hpp | 10 ++--
   sandbox/task/boost/task/detail/config.hpp | 2
   sandbox/task/libs/task/examples/bind_to_processors.cpp | 12 ++--
   sandbox/task/libs/task/examples/delay.cpp | 12 ++--
   sandbox/task/libs/task/examples/fork_join.cpp | 12 ++--
   sandbox/task/libs/task/examples/interrupt.cpp | 9 +--
   sandbox/task/libs/task/examples/pending.cpp | 9 +--
   sandbox/task/libs/task/examples/priority.cpp | 16 +++---
   sandbox/task/libs/task/examples/reschedule_until.cpp | 16 +++---
   sandbox/task/libs/task/examples/shutdonw_now.cpp | 4
   sandbox/task/libs/task/examples/smart.cpp | 16 +++---
   sandbox/task/libs/task/examples/submit.cpp | 13 ++--
   sandbox/task/libs/task/examples/yield.cpp | 12 ++--
   sandbox/task/libs/task/test/test_bounded_pool.cpp | 90 ++++++++++++++++++-------------------
   sandbox/task/libs/task/test/test_default_pool.cpp | 34 ++++++-------
   sandbox/task/libs/task/test/test_new_thread.cpp | 34 ++++++-------
   sandbox/task/libs/task/test/test_own_thread.cpp | 38 +++++++--------
   sandbox/task/libs/task/test/test_unbounded_pool.cpp | 82 +++++++++++++++++-----------------
   24 files changed, 225 insertions(+), 305 deletions(-)

Modified: sandbox/task/boost/task.hpp
==============================================================================
--- sandbox/task/boost/task.hpp (original)
+++ sandbox/task/boost/task.hpp 2009-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -7,6 +7,7 @@
 #ifndef BOOST_TASK_H
 #define BOOST_TASK_H
 
+#include <boost/task/as_sub_task.hpp>
 #include <boost/task/async.hpp>
 #include <boost/task/bounded_channel.hpp>
 #include <boost/task/default_pool.hpp>
@@ -16,6 +17,8 @@
 #include <boost/task/handle.hpp>
 #include <boost/task/id.hpp>
 #include <boost/task/meta.hpp>
+#include <boost/task/new_thread.hpp>
+#include <boost/task/own_thread.hpp>
 #include <boost/task/poolsize.hpp>
 #include <boost/task/priority.hpp>
 #include <boost/task/scanns.hpp>

Added: sandbox/task/boost/task/as_sub_task.hpp
==============================================================================
--- (empty file)
+++ sandbox/task/boost/task/as_sub_task.hpp 2009-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -0,0 +1,56 @@
+
+// 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)
+
+#ifndef BOOST_TASK_AS_SUB_TASK_H
+#define BOOST_TASK_AS_SUB_TASK_H
+
+#include <boost/bind.hpp>
+#include <boost/function.hpp>
+
+#include <boost/task/detail/interrupter.hpp>
+#include <boost/task/detail/worker.hpp>
+#include <boost/task/future.hpp>
+#include <boost/task/handle.hpp>
+#include <boost/task/new_thread.hpp>
+#include <boost/task/task.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost { namespace task
+{
+
+struct as_sub_task
+{
+ template< typename R >
+ handle< R > operator()( task< R > t)
+ {
+ detail::worker * w( detail::worker::tss_get() );
+ if ( w)
+ {
+ detail::interrupter intr;
+ shared_future< R > fut( t.get_future() );
+ function< bool() > wcb(
+ bind(
+ & shared_future< R >::is_ready,
+ fut) );
+ t.set_wait_callback(
+ bind(
+ ( void ( detail::worker::*)( function< bool() > const&) ) & detail::worker::reschedule_until,
+ w,
+ wcb) );
+ w->put( detail::pool_callable( t, intr) );
+ return handle< R >( t.get_id(), fut, intr);
+ }
+ else
+ return new_thread()( t);
+ }
+};
+
+} }
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif // BOOST_TASK_AS_SUB_TASK_H

Modified: sandbox/task/boost/task/async.hpp
==============================================================================
--- sandbox/task/boost/task/async.hpp (original)
+++ sandbox/task/boost/task/async.hpp 2009-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -7,18 +7,8 @@
 #ifndef BOOST_TASK_ASYNC_H
 #define BOOST_TASK_ASYNC_H
 
-#include <boost/bind.hpp>
-#include <boost/function.hpp>
-#include <boost/shared_ptr.hpp>
-#include <boost/thread.hpp>
-
-#include <boost/task/default_pool.hpp>
-#include <boost/task/detail/interrupter.hpp>
-#include <boost/task/detail/pool_callable.hpp>
-#include <boost/task/detail/thread_callable.hpp>
-#include <boost/task/detail/worker.hpp>
+#include <boost/task/as_sub_task.hpp>
 #include <boost/task/handle.hpp>
-#include <boost/task/future.hpp>
 #include <boost/task/static_pool.hpp>
 #include <boost/task/task.hpp>
 
@@ -27,88 +17,20 @@
 namespace boost { namespace task
 {
 
-namespace detail
-{
-struct joiner
-{
- void operator()( thread * thrd)
- {
- try
- { thrd->join(); }
- catch (...)
- {}
- delete thrd;
- }
-};
-}
-
-struct own_thread
-{
- template< typename R >
- handle< R > operator()( task< R > t)
- {
- t();
- detail::interrupter intr;
- intr.reset();
- return handle< R >(
- t.get_id(),
- t.get_future(),
- intr);
- }
-};
-
-struct new_thread
-{
- template< typename R >
- handle< R > operator()( task< R > t)
- {
- detail::interrupter intr;
- detail::thread_callable ca( t, intr);
-
- shared_ptr< thread > thrd( new thread( ca), detail::joiner() );
- intr.set( thrd);
-
- return handle< R >( t.get_id(), t.get_future(), intr);
- }
-};
-
-struct as_sub_task
-{
- template< typename R >
- handle< R > operator()( task< R > t)
- {
- detail::worker * w( detail::worker::tss_get() );
- if ( w)
- {
- detail::interrupter intr;
- shared_future< R > fut( t.get_future() );
- function< bool() > wcb(
- bind(
- & shared_future< R >::is_ready,
- fut) );
- t.set_wait_callback(
- bind(
- ( void ( detail::worker::*)( function< bool() > const&) ) & detail::worker::reschedule_until,
- w,
- wcb) );
- w->put( detail::pool_callable( t, intr) );
- return handle< R >( t.get_id(), fut, intr);
- }
- else
- return new_thread()( t);
- }
-};
+template< typename R >
+handle< R > async( task< R > t)
+{ return as_sub_task()( t); }
 
-template< typename AE, typename R >
-handle< R > async( AE ae, task< R > t)
+template< typename R, typename AE >
+handle< R > async( task< R > t, AE ae)
 { return ae( t); }
 
 template< typename R, typename Channel >
-handle< R > async( static_pool< Channel > & pool, task< R > t)
+handle< R > async( task< R > t, static_pool< Channel > & pool)
 { return pool.submit( t); }
 
 template< typename R, typename Channel, typename Attr >
-handle< R > async( static_pool< Channel > & pool, task< R > t, Attr attr)
+handle< R > async( task< R > t, Attr attr, static_pool< Channel > & pool)
 { return pool.submit( t, attr); }
 
 } }

Modified: sandbox/task/boost/task/detail/atomic_gcc.hpp
==============================================================================
--- sandbox/task/boost/task/detail/atomic_gcc.hpp (original)
+++ sandbox/task/boost/task/detail/atomic_gcc.hpp 2009-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -34,7 +34,10 @@
 
 inline
 void atomic_exchange( uint32_t volatile * object, uint32_t desired)
-{ * object = desired; }
+{
+ // inline asm xchg for i386 || x86_64?
+ * object = desired;
+}
 
 inline
 uint32_t atomic_fetch_add( uint32_t volatile * object, uint32_t operand)

Modified: sandbox/task/boost/task/detail/atomic_gcc_ppc.hpp
==============================================================================
--- sandbox/task/boost/task/detail/atomic_gcc_ppc.hpp (original)
+++ sandbox/task/boost/task/detail/atomic_gcc_ppc.hpp 2009-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -7,6 +7,9 @@
 #ifndef BOOST_TASK_DETAIL_ATOMIC_GCC_PPC_H
 #define BOOST_TASK_DETAIL_ATOMIC_GCC_PPC_H
 
+#include <boost/assert.hpp>
+#include <boost/cstdint.hpp>
+
 #include <boost/config/abi_prefix.hpp>
 
 namespace boost { namespace task

Modified: sandbox/task/boost/task/detail/atomic_gcc_x86.hpp
==============================================================================
--- sandbox/task/boost/task/detail/atomic_gcc_x86.hpp (original)
+++ sandbox/task/boost/task/detail/atomic_gcc_x86.hpp 2009-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -7,6 +7,9 @@
 #ifndef BOOST_TASK_DETAIL_ATOMIC_GCC_X86_H
 #define BOOST_TASK_DETAIL_ATOMIC_GCC_X86_H
 
+#include <boost/assert.hpp>
+#include <boost/cstdint.hpp>
+
 #include <boost/config/abi_prefix.hpp>
 
 namespace boost { namespace task

Modified: sandbox/task/boost/task/detail/atomic_solaris.hpp
==============================================================================
--- sandbox/task/boost/task/detail/atomic_solaris.hpp (original)
+++ sandbox/task/boost/task/detail/atomic_solaris.hpp 2009-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -13,6 +13,7 @@
 }
 
 #include <boost/assert.hpp>
+#include <boost/cstdint.hpp>
 
 #include <boost/config/abi_prefix.hpp>
 

Modified: sandbox/task/boost/task/detail/bind_processor.hpp
==============================================================================
--- sandbox/task/boost/task/detail/bind_processor.hpp (original)
+++ sandbox/task/boost/task/detail/bind_processor.hpp 2009-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -9,19 +9,19 @@
 
 #include <boost/task/detail/config.hpp>
 
-# if defined(BOOST_TASK_WIN32)
+# if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
 # define BOOST_HAS_PROCESSOR_BINDINGS 1
 # include <boost/task/detail/bind_processor_windows.hpp>
-# elif defined(BOOST_TASK_LINUX)
+# elif defined(linux) || defined(__linux) || defined(__linux__)
 # define BOOST_HAS_PROCESSOR_BINDINGS 1
 # include <boost/task/detail/bind_processor_linux.hpp>
-# elif defined(BOOST_TASK_AIX)
+# elif defined(__IBMCPP__) || defined(_AIX)
 # define BOOST_HAS_PROCESSOR_BINDINGS 1
 # include <boost/task/detail/bind_processor_aix.hpp>
-# elif defined(BOOST_TASK_HPUX)
+# elif defined(__hpux)
 # define BOOST_HAS_PROCESSOR_BINDINGS 1
 # include <boost/task/detail/bind_processor_hpux.hpp>
-# elif defined(BOOST_TASK_SOLARIS)
+# elif defined(sun) || defined(__sun)
 # define BOOST_HAS_PROCESSOR_BINDINGS 1
 # include <boost/task/detail/bind_processor_solaris.hpp>
 # else

Modified: sandbox/task/boost/task/detail/config.hpp
==============================================================================
--- sandbox/task/boost/task/detail/config.hpp (original)
+++ sandbox/task/boost/task/detail/config.hpp 2009-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -19,8 +19,6 @@
 # pragma warn -8066 // Unreachable code
 # endif
 
-#include <boost/task/detail/platform.hpp>
-
 # if defined(BOOST_TASK_DYN_DLL) || defined(BOOST_ALL_DYN_LINK)
 # undef BOOST_TASK_USE_LIB
 # define BOOST_TASK_USE_DLL

Deleted: sandbox/task/boost/task/detail/platform.hpp
==============================================================================
--- sandbox/task/boost/task/detail/platform.hpp 2009-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
+++ (empty file)
@@ -1,37 +0,0 @@
-
-// 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)
-
-// this file is based on platform.hpp of boost.thread
-
-#ifndef BOOST_TASK_DETAIL_PLATFORM_H
-#define BOOST_TASK_DETAIL_PLATFORM_H
-
-// fetch compiler and platform configuration
-#include <boost/config.hpp>
-
-// insist on threading support being available:
-#include <boost/config/requires_threads.hpp>
-
-// choose platform
-# if defined(linux) || defined(__linux) || defined(__linux__)
-# define BOOST_TASK_LINUX
-# elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
-# define BOOST_TASK_BSD
-# elif defined(sun) || defined(__sun)
-# define BOOST_TASK_SOLARIS
-# elif defined(__hpux)
-# define BOOST_TASK_HPUX
-# elif defined(__CYGWIN__)
-# define BOOST_TASK_CYGWIN
-# elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
-# define BOOST_TASK_WIN32
-# elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
-# define BOOST_TASK_MACOS
-# elif defined(__IBMCPP__) || defined(_AIX)
-# define BOOST_TASK_AIX
-# endif
-
-#endif // BOOST_TASK_DETAIL_PLATFORM_H

Added: sandbox/task/boost/task/new_thread.hpp
==============================================================================
--- (empty file)
+++ sandbox/task/boost/task/new_thread.hpp 2009-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -0,0 +1,59 @@
+
+// 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)
+
+#ifndef BOOST_TASK_NEW_THREAD_H
+#define BOOST_TASK_NEW_THREAD_H
+
+#include <boost/shared_ptr.hpp>
+#include <boost/thread.hpp>
+
+#include <boost/task/detail/interrupter.hpp>
+#include <boost/task/detail/thread_callable.hpp>
+#include <boost/task/handle.hpp>
+#include <boost/task/task.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost { namespace task
+{
+
+namespace detail
+{
+
+struct joiner
+{
+ void operator()( thread * thrd)
+ {
+ try
+ { thrd->join(); }
+ catch (...)
+ {}
+ delete thrd;
+ }
+};
+
+}
+
+struct new_thread
+{
+ template< typename R >
+ handle< R > operator()( task< R > t)
+ {
+ detail::interrupter intr;
+ detail::thread_callable ca( t, intr);
+
+ shared_ptr< thread > thrd( new thread( ca), detail::joiner() );
+ intr.set( thrd);
+
+ return handle< R >( t.get_id(), t.get_future(), intr);
+ }
+};
+
+} }
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif // BOOST_TASK_NEW_THREAD_H

Added: sandbox/task/boost/task/own_thread.hpp
==============================================================================
--- (empty file)
+++ sandbox/task/boost/task/own_thread.hpp 2009-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -0,0 +1,38 @@
+
+// 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)
+
+#ifndef BOOST_TASK_OWN_THREAD_H
+#define BOOST_TASK_OWN_THREAD_H
+
+#include <boost/task/detail/interrupter.hpp>
+#include <boost/task/handle.hpp>
+#include <boost/task/task.hpp>
+
+#include <boost/config/abi_prefix.hpp>
+
+namespace boost { namespace task
+{
+
+struct own_thread
+{
+ template< typename R >
+ handle< R > operator()( task< R > t)
+ {
+ t();
+ detail::interrupter intr;
+ intr.reset();
+ return handle< R >(
+ t.get_id(),
+ t.get_future(),
+ intr);
+ }
+};
+
+} }
+
+#include <boost/config/abi_suffix.hpp>
+
+#endif // BOOST_TASK_OWN_THREAD_H

Added: sandbox/task/change.log
==============================================================================
--- (empty file)
+++ sandbox/task/change.log 2009-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -0,0 +1,8 @@
+* boost.task-0.2:
+-----------------
+- detail/atomic.hpp splitt into several headers for different platforms
+ - xchg for gcc && x86
+ - lwarx for gcc && powrepc
+- new function shared_future< R > handle< R >::get_future()
+- new_thread, own_thread and as_sub_task in separat headers
+- async() with as_sub_task as default async. executor

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-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -46,18 +46,18 @@
                         BOOST_ASSERT( boost::this_task::runs_in_pool() );
                         tsk::handle< long > h1(
                                 tsk::async(
- boost::task::as_sub_task(), // do not use this_task::get_pool() because it doesn't create as sub-task
                                         tsk::make_task(
                                                 & fib_task::execute,
                                                 this,
- n - 1) ) ) ;
+ n - 1),
+ boost::task::as_sub_task() ) ); // do not use this_task::get_pool() because it doesn't create as sub-task
                         tsk::handle< long > h2(
                                 tsk::async(
- boost::task::as_sub_task(), // do not use this_task::get_pool() because it doesn't create as sub-task
                                         tsk::make_task(
                                                 & fib_task::execute,
                                                 this,
- n - 2) ) );
+ n - 2),
+ boost::task::as_sub_task() ) ); // do not use this_task::get_pool() because it doesn't create as sub-task
                         return h1.get() + h2.get();
                 }
         }
@@ -85,10 +85,10 @@
                 for ( int i = 0; i < 10; ++i)
                         results.push_back(
                                 tsk::async(
- pool,
                                         tsk::make_task(
                                                 & parallel_fib,
- i) ) );
+ i),
+ pool) );
 
                 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-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -47,18 +47,18 @@
                 {
                         tsk::handle< long > h1(
                                 tsk::async(
- tsk::as_sub_task(),
                                         tsk::make_task(
                                                 & fib_task::execute,
                                                 boost::ref( * this),
- n - 1) ) );
+ n - 1),
+ tsk::as_sub_task() ) );
                         tsk::handle< long > h2(
                                 tsk::async(
- tsk::as_sub_task(),
                                         tsk::make_task(
                                                 & fib_task::execute,
                                                 boost::ref( * this),
- n - 2) ) );
+ n - 2),
+ tsk::as_sub_task() ) );
                         return h1.get() + h2.get();
                 }
         }
@@ -78,10 +78,10 @@
         {
                 for ( int i = 0; i < 10; ++i)
                         tsk::async(
- tsk::default_pool(),
                                 tsk::make_task(
                                         & parallel_fib,
- i) );
+ i),
+ tsk::as_sub_task() );
 
                 return EXIT_SUCCESS;
         }

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-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -35,18 +35,18 @@
                 BOOST_ASSERT( boost::this_task::runs_in_pool() );
                 tsk::handle< long > h1(
                         tsk::async(
- tsk::as_sub_task(),
                                 tsk::make_task(
                                         parallel_fib,
                                         n - 1,
- cutof) ) ) ;
+ cutof),
+ tsk::as_sub_task() ) ) ;
                 tsk::handle< long > h2(
                         tsk::async(
- tsk::as_sub_task(),
                                 tsk::make_task(
                                         parallel_fib,
                                         n - 2,
- cutof) ) );
+ cutof),
+ tsk::as_sub_task() ) );
                 return h1.get() + h2.get();
         }
 }
@@ -65,11 +65,11 @@
                 for ( int i = 0; i < 10; ++i)
                         results.push_back(
                                 tsk::async(
- pool,
                                         tsk::make_task(
                                                 & parallel_fib,
                                                 i,
- 5) ) );
+ 5),
+ pool) );
 
                 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-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -43,18 +43,17 @@
         try
         {
                 tsk::async(
- tsk::default_pool(),
- tsk::make_task(
- long_running_fn) );
+ tsk::make_task( long_running_fn),
+ tsk::default_pool() );
                 std::cout << "poolsize == " << tsk::default_pool().size() << std::endl;
                 std::cout << "idle threads == " << tsk::default_pool().idle() << std::endl;
                 std::cout << "active threads == " << tsk::default_pool().active() << std::endl;
                 tsk::handle< int > h(
                         tsk::async(
- tsk::default_pool(),
                                 tsk::make_task(
                                         fibonacci_fn,
- 10) ) );
+ 10),
+ tsk::default_pool() ) );
                 h.interrupt();
                 std::cout << h.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-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -44,15 +44,14 @@
         try
         {
                 tsk::async(
- tsk::default_pool(),
- tsk::make_task(
- long_running_fn) );
+ tsk::make_task( long_running_fn),
+ tsk::default_pool() );
                 tsk::handle< int > h(
                         tsk::async(
- tsk::default_pool(),
                                 tsk::make_task(
                                         fibonacci_fn,
- 10) ) );
+ 10),
+ tsk::default_pool() ) );
                 std::cout << "pending tasks == " << tsk::default_pool().pending() << std::endl;
                 std::cout << h.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-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -34,28 +34,28 @@
> pool( tsk::poolsize( 1) );
 
                 tsk::async(
- pool,
                         tsk::make_task(
                                 long_running_fn),
- 0);
+ 0,
+ pool);
                 tsk::async(
- pool,
                         tsk::make_task(
                                 print_fn,
                                 "This"),
- 0);
+ 0,
+ pool);
                 tsk::async(
- pool,
                         tsk::make_task(
                                 print_fn,
                                 "a text.\n"),
- 2);
+ 2,
+ pool);
                 tsk::async(
- pool,
                         tsk::make_task(
                                 print_fn,
                                 " is "),
- 1);
+ 1,
+ pool);
 
                 return EXIT_SUCCESS;
         }

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-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -59,18 +59,18 @@
                         BOOST_ASSERT( boost::this_task::runs_in_pool() );
                         tsk::handle< long > h1(
                                 tsk::async(
- tsk::as_sub_task(),
                                         tsk::make_task(
                                                 & fib_task::execute,
                                                 boost::ref( * this),
- n - 1) ) );
+ n - 1),
+ tsk::as_sub_task() ) );
                         tsk::handle< long > h2(
                                 tsk::async(
- tsk::as_sub_task(),
                                         tsk::make_task(
                                                 & fib_task::execute,
                                                 boost::ref( * this),
- n - 2) ) );
+ n - 2),
+ tsk::as_sub_task() ) );
                         return h1.get() + h2.get();
                 }
         }
@@ -152,20 +152,20 @@
                 create_sockets( fd);
 
                 tsk::async(
- tsk::default_pool(),
                         tsk::make_task(
                                 & do_read,
- fd[0]) );
+ fd[0]),
+ tsk::default_pool() );
 
                 do_write( fd[1], "Hello ");
                 boost::this_thread::sleep( pt::seconds( 1) );
 
                 for ( int i = 0; i < 10; ++i)
                         tsk::async(
- tsk::default_pool(),
                                 tsk::make_task(
                                         & parallel_fib,
- i) );
+ i),
+ tsk::default_pool() );
 
                 do_write( fd[1], "World!");
 

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-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -46,10 +46,10 @@
 
                 tsk::handle< int > h(
                         tsk::async(
- pool,
                                 tsk::make_task(
                                         fibonacci_fn,
- 10) ) );
+ 10),
+ pool) );
 
                 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-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -60,28 +60,28 @@
> pool( tsk::poolsize( 1) );
 
                 tsk::async(
- pool,
                         tsk::make_task(
                                 long_running_fn),
- 0);
+ 0,
+ pool);
                 tsk::async(
- pool,
                         tsk::make_task(
                                 fibonacci_fn,
                                 0),
- 1);
+ 1,
+ pool);
                 tsk::async(
- pool,
                         tsk::make_task(
                                 fibonacci_fn,
                                 1),
- 2);
+ 2,
+ pool);
                 tsk::async(
- pool,
                         tsk::make_task(
                                 fibonacci_fn,
                                 10),
- 2);
+ 2,
+ pool);
 
                 return EXIT_SUCCESS;
         }

Modified: sandbox/task/libs/task/examples/submit.cpp
==============================================================================
--- sandbox/task/libs/task/examples/submit.cpp (original)
+++ sandbox/task/libs/task/examples/submit.cpp 2009-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -37,32 +37,31 @@
         {
                 tsk::handle< int > h1(
                         tsk::async(
- tsk::own_thread(),
                                 tsk::make_task(
                                         fibonacci_fn,
                                         10) ) );
                 tsk::handle< int > h2(
                         tsk::async(
- tsk::new_thread(),
                                 tsk::make_task(
                                         fibonacci_fn,
- 10) ) );
+ 10),
+ tsk::new_thread() ) );
                 tsk::handle< int > h3(
                         tsk::async(
- tsk::default_pool(),
                                 tsk::make_task(
                                         fibonacci_fn,
- 10) ) );
+ 10),
+ tsk::default_pool() ) );
                 tsk::static_pool<
                         tsk::unbounded_channel< tsk::priority< int > >
> pool( tsk::poolsize( 3) );
                 tsk::handle< int > h4(
                         tsk::async(
- pool,
                                 tsk::make_task(
                                         fibonacci_fn,
                                         10),
- 2) );
+ 2,
+ pool) );
                 std::cout << h1.get() << std::endl;
                 std::cout << h2.get() << std::endl;
                 std::cout << h3.get() << std::endl;

Modified: sandbox/task/libs/task/examples/yield.cpp
==============================================================================
--- sandbox/task/libs/task/examples/yield.cpp (original)
+++ sandbox/task/libs/task/examples/yield.cpp 2009-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -50,18 +50,18 @@
                         BOOST_ASSERT( boost::this_task::runs_in_pool() );
                         tsk::handle< long > h1(
                                 tsk::async(
- tsk::as_sub_task(),
                                         tsk::make_task(
                                                 & fib_task::execute,
                                                 boost::ref( * this),
- n - 1) ) );
+ n - 1),
+ tsk::as_sub_task() ) );
                         tsk::handle< long > h2(
                                 tsk::async(
- tsk::as_sub_task(),
                                         tsk::make_task(
                                                 & fib_task::execute,
                                                 boost::ref( * this),
- n - 2) ) );
+ n - 2),
+ tsk::as_sub_task() ) );
                         return h1.get() + h2.get();
                 }
         }
@@ -81,10 +81,10 @@
         {
                 for ( int i = 0; i < 10; ++i)
                         tsk::async(
- tsk::default_pool(),
                                 tsk::make_task(
                                         & parallel_fib,
- i) );
+ i),
+ tsk::default_pool() );
 
                 return EXIT_SUCCESS;
         }

Modified: sandbox/task/libs/task/test/test_bounded_pool.cpp
==============================================================================
--- sandbox/task/libs/task/test/test_bounded_pool.cpp (original)
+++ sandbox/task/libs/task/test/test_bounded_pool.cpp 2009-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -55,10 +55,10 @@
                         tsk::low_watermark( 10) );
                 tsk::handle< int > h(
                         tsk::async(
- pool,
                                 tsk::make_task(
                                         fibonacci_fn,
- 10) ) );
+ 10),
+ pool) );
                 BOOST_CHECK_EQUAL( h.get(), 55);
         }
 
@@ -73,9 +73,8 @@
                         tsk::low_watermark( 10) );
                 tsk::handle< bool > h(
                         tsk::async(
- pool,
- tsk::make_task(
- runs_in_pool_fn) ) );
+ tsk::make_task( runs_in_pool_fn),
+ pool) );
                 BOOST_CHECK_EQUAL( h.get(), true);
         }
 
@@ -115,10 +114,10 @@
                         tsk::low_watermark( 10) );
                 tsk::handle< int > h(
                         tsk::async(
- pool,
                                 tsk::make_task(
                                         fibonacci_fn,
- 10) ) );
+ 10),
+ pool) );
                 pool.shutdown();
                 BOOST_CHECK( pool.closed() );
                 BOOST_CHECK_EQUAL( h.get(), 55);
@@ -135,9 +134,8 @@
                         tsk::low_watermark( 10) );
                 tsk::handle< void > h(
                         tsk::async(
- pool,
- tsk::make_task(
- throwing_fn) ) );
+ tsk::make_task( throwing_fn),
+ pool) );
                 pool.shutdown();
                 BOOST_CHECK_THROW( h.get(), std::runtime_error);
         }
@@ -155,11 +153,11 @@
                 BOOST_CHECK( pool.closed() );
                 BOOST_CHECK_THROW(
                         tsk::async(
- pool,
                                 tsk::make_task(
                                         boost::bind(
                                                 fibonacci_fn,
- 10) ) ),
+ 10) ),
+ pool),
                         tsk::task_rejected);
         }
 
@@ -174,10 +172,10 @@
                         tsk::low_watermark( 1) );
                 tsk::handle< void > h(
                         tsk::async(
- pool,
                                 tsk::make_task(
                                         delay_fn,
- pt::millisec( 500) ) ) );
+ pt::millisec( 500) ),
+ pool) );
                 boost::this_thread::sleep( pt::millisec( 250) );
                 BOOST_CHECK_EQUAL( pool.size(), std::size_t( 1) );
                 pool.shutdown_now();
@@ -201,26 +199,26 @@
                 boost::barrier b( 2);
                 tsk::handle< void > h1(
                         tsk::async(
- pool,
                                 tsk::make_task(
                                         barrier_fn,
- boost::ref( b) ) ) );
+ boost::ref( b) ),
+ pool) );
                 boost::this_thread::sleep( pt::millisec( 250) );
                 BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 0) );
                 tsk::handle< int > h2(
                         tsk::async(
- pool,
                                 tsk::make_task(
                                         fibonacci_fn,
- 10) ) );
+ 10),
+ pool) );
                 boost::this_thread::sleep( pt::millisec(250) );
                 BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 1) );
                 tsk::handle< int > h3(
                         tsk::async(
- pool,
                                 tsk::make_task(
                                         fibonacci_fn,
- 10) ) );
+ 10),
+ pool) );
                 boost::this_thread::sleep( pt::millisec(250) );
                 BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 2) );
                 b.wait();
@@ -242,24 +240,24 @@
                         tsk::low_watermark( 10) );
                 boost::barrier b( 2);
                 tsk::async(
- pool,
                         tsk::make_task(
                                 barrier_fn,
- boost::ref( b) ) );
+ boost::ref( b) ),
+ pool);
                 std::vector< int > buffer;
                 tsk::handle< void > h(
                         tsk::async(
- pool,
                                 tsk::make_task(
                                         buffer_fibonacci_fn,
                                         boost::ref( buffer),
- 10) ) );
+ 10),
+ pool) );
                 tsk::async(
- pool,
                         tsk::make_task(
                                 buffer_fibonacci_fn,
                                 boost::ref( buffer),
- 0) );
+ 0),
+ pool);
                 h.interrupt();
                 b.wait();
                 pool.shutdown();
@@ -281,23 +279,23 @@
                         tsk::low_watermark( 10) );
                 boost::barrier b( 2);
                 tsk::async(
- pool,
                         tsk::make_task(
                                 barrier_fn,
- boost::ref( b) ) );
+ boost::ref( b) ),
+ pool);
                 std::vector< int > buffer;
                 tsk::async(
- pool,
                         tsk::make_task(
                                 buffer_fibonacci_fn,
                                 boost::ref( buffer),
- 10) );
+ 10),
+ pool);
                 tsk::async(
- pool,
                         tsk::make_task(
                                 buffer_fibonacci_fn,
                                 boost::ref( buffer),
- 0) );
+ 0),
+ pool);
                 b.wait();
                 pool.shutdown();
                 BOOST_CHECK_EQUAL( buffer[0], 55);
@@ -320,26 +318,26 @@
                         tsk::low_watermark( 10) );
                 boost::barrier b( 2);
                 tsk::async(
- pool,
                         tsk::make_task(
                                 barrier_fn,
                                 boost::ref( b) ),
- 0);
+ 0,
+ pool);
                 std::vector< int > buffer;
                 tsk::async(
- pool,
                         tsk::make_task(
                                 buffer_fibonacci_fn,
                                 boost::ref( buffer),
                                 10),
- 1);
+ 1,
+ pool);
                 tsk::async(
- pool,
                         tsk::make_task(
                                 buffer_fibonacci_fn,
                                 boost::ref( buffer),
                                 0),
- 0);
+ 0,
+ pool);
                 b.wait();
                 pool.shutdown();
                 BOOST_CHECK_EQUAL( buffer[0], 0);
@@ -362,33 +360,33 @@
                         tsk::low_watermark( 10) );
                 boost::barrier b( 2);
                 tsk::async(
- pool,
                         tsk::make_task(
                                 barrier_fn,
                                 boost::ref( b) ),
- 0);
+ 0,
+ pool);
                 std::vector< int > buffer;
                 tsk::async(
- pool,
                         tsk::make_task(
                                 buffer_fibonacci_fn,
                                 boost::ref( buffer),
                                 10),
- 2);
+ 2,
+ pool);
                 tsk::async(
- pool,
                         tsk::make_task(
                                 buffer_fibonacci_fn,
                                 boost::ref( buffer),
                                 0),
- 1);
+ 1,
+ pool);
                 tsk::async(
- pool,
                         tsk::make_task(
                                 buffer_fibonacci_fn,
                                 boost::ref( buffer),
                                 1),
- 2);
+ 2,
+ pool);
                 b.wait();
                 pool.shutdown();
                 BOOST_CHECK_EQUAL( buffer[0], 0);

Modified: sandbox/task/libs/task/test/test_default_pool.cpp
==============================================================================
--- sandbox/task/libs/task/test/test_default_pool.cpp (original)
+++ sandbox/task/libs/task/test/test_default_pool.cpp 2009-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -38,8 +38,8 @@
                                 10) );
                 tsk::handle< int > h(
                         tsk::async(
- tsk::default_pool(),
- t) );
+ t,
+ tsk::default_pool() ) );
                 BOOST_CHECK_EQUAL( h.get_id(), t.get_id() );
                 BOOST_CHECK_EQUAL( h.get(), 55);
         }
@@ -49,9 +49,8 @@
         {
                 tsk::handle< bool > h(
                         tsk::async(
- tsk::default_pool(),
- tsk::make_task(
- runs_in_pool_fn) ) );
+ tsk::make_task( runs_in_pool_fn),
+ tsk::default_pool() ) );
                 BOOST_CHECK_EQUAL( h.get(), true);
         }
 
@@ -79,9 +78,8 @@
         {
                 tsk::handle< void > h(
                         tsk::async(
- tsk::default_pool(),
- tsk::make_task(
- throwing_fn) ) );
+ tsk::make_task( throwing_fn),
+ tsk::default_pool() ) );
                 BOOST_CHECK_THROW( h.get(), std::runtime_error);
         }
 
@@ -90,10 +88,10 @@
         {
                 tsk::handle< void > h(
                         tsk::async(
- tsk::default_pool(),
                                 tsk::make_task(
                                         delay_fn,
- pt::seconds( 3) ) ) );
+ pt::seconds( 3) ),
+ tsk::default_pool() ) );
                 h.interrupt();
                 BOOST_CHECK( h.interruption_requested() );
                 BOOST_CHECK_THROW( h.get(), tsk::task_interrupted);
@@ -105,11 +103,11 @@
                 bool finished( false);
                 tsk::handle< void > h(
                         tsk::async(
- tsk::default_pool(),
                                 tsk::make_task(
                                         interrupt_fn,
                                         pt::seconds( 3),
- boost::ref( finished) ) ) );
+ boost::ref( finished) ),
+ tsk::default_pool() ) );
                 h.interrupt_and_wait();
                 BOOST_CHECK( finished);
                 BOOST_CHECK( h.is_ready() );
@@ -124,10 +122,10 @@
                 for ( int i = 0; i <= 5; ++i)
                         vec.push_back(
                                 tsk::async(
- tsk::default_pool(),
                                         tsk::make_task(
                                                 fibonacci_fn,
- i) ) );
+ i),
+ tsk::default_pool() ) );
                 tsk::waitfor_all( vec.begin(), vec.end() );
                 BOOST_CHECK( vec[0].is_ready() );
                 BOOST_CHECK( vec[1].is_ready() );
@@ -148,16 +146,16 @@
         {
                 tsk::handle< void > h1(
                         tsk::async(
- tsk::default_pool(),
                                 tsk::make_task(
                                         delay_fn,
- pt::seconds( 3) ) ) );
+ pt::seconds( 3) ),
+ tsk::default_pool() ) );
                 tsk::handle< int > h2(
                         tsk::async(
- tsk::default_pool(),
                                 tsk::make_task(
                                         fibonacci_fn,
- 10) ) );
+ 10),
+ tsk::default_pool() ) );
                 tsk::waitfor_any( h1, h2);
                 BOOST_CHECK( ! h1.is_ready() );
                 BOOST_CHECK( h2.is_ready() );

Modified: sandbox/task/libs/task/test/test_new_thread.cpp
==============================================================================
--- sandbox/task/libs/task/test/test_new_thread.cpp (original)
+++ sandbox/task/libs/task/test/test_new_thread.cpp 2009-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -38,8 +38,8 @@
                                 10) );
                 tsk::handle< int > h(
                         tsk::async(
- tsk::new_thread(),
- t) );
+ t,
+ tsk::new_thread() ) );
                 BOOST_CHECK_EQUAL( h.get_id(), t.get_id() );
                 BOOST_CHECK_EQUAL( h.get(), 55);
         }
@@ -49,9 +49,8 @@
         {
                 tsk::handle< bool > h(
                         tsk::async(
- tsk::new_thread(),
- tsk::make_task(
- runs_in_pool_fn) ) );
+ tsk::make_task( runs_in_pool_fn),
+ tsk::new_thread() ) );
                 BOOST_CHECK_EQUAL( h.get(), false);
         }
 
@@ -79,9 +78,8 @@
         {
                 tsk::handle< void > h(
                         tsk::async(
- tsk::new_thread(),
- tsk::make_task(
- throwing_fn) ) );
+ tsk::make_task( throwing_fn),
+ tsk::new_thread() ) );
                 BOOST_CHECK_THROW( h.get(), std::runtime_error);
         }
 
@@ -90,10 +88,10 @@
         {
                 tsk::handle< void > h(
                         tsk::async(
- tsk::new_thread(),
                                 tsk::make_task(
                                         delay_fn,
- pt::seconds( 3) ) ) );
+ pt::seconds( 3) ),
+ tsk::new_thread() ) );
                 h.interrupt();
                 BOOST_CHECK( h.interruption_requested() );
                 BOOST_CHECK_THROW( h.get(), tsk::task_interrupted);
@@ -105,11 +103,11 @@
                 bool finished( false);
                 tsk::handle< void > h(
                         tsk::async(
- tsk::new_thread(),
                                 tsk::make_task(
                                         interrupt_fn,
                                         pt::seconds( 3),
- boost::ref( finished) ) ) );
+ boost::ref( finished) ),
+ tsk::new_thread() ) );
                 h.interrupt_and_wait();
                 BOOST_CHECK( finished);
                 BOOST_CHECK( h.is_ready() );
@@ -124,10 +122,10 @@
                 for ( int i = 0; i <= 5; ++i)
                         vec.push_back(
                                 tsk::async(
- tsk::new_thread(),
                                         tsk::make_task(
                                                 fibonacci_fn,
- i) ) );
+ i),
+ tsk::new_thread() ) );
                 tsk::waitfor_all( vec.begin(), vec.end() );
                 BOOST_CHECK( vec[0].is_ready() );
                 BOOST_CHECK( vec[1].is_ready() );
@@ -148,16 +146,16 @@
         {
                 tsk::handle< void > h1(
                         tsk::async(
- tsk::new_thread(),
                                 tsk::make_task(
                                         delay_fn,
- pt::seconds( 3) ) ) );
+ pt::seconds( 3) ),
+ tsk::new_thread() ) );
                 tsk::handle< int > h2(
                         tsk::async(
- tsk::new_thread(),
                                 tsk::make_task(
                                         fibonacci_fn,
- 10) ) );
+ 10),
+ tsk::new_thread() ) );
                 tsk::waitfor_any( h1, h2);
                 BOOST_CHECK( ! h1.is_ready() );
                 BOOST_CHECK( h2.is_ready() );

Modified: sandbox/task/libs/task/test/test_own_thread.cpp
==============================================================================
--- sandbox/task/libs/task/test/test_own_thread.cpp (original)
+++ sandbox/task/libs/task/test/test_own_thread.cpp 2009-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -38,8 +38,8 @@
                                 10) );
                 tsk::handle< int > h(
                         tsk::async(
- tsk::own_thread(),
- t) );
+ t,
+ tsk::own_thread() ) );
                 BOOST_CHECK_EQUAL( h.get_id(), t.get_id() );
                 BOOST_CHECK_EQUAL( h.get(), 55);
         }
@@ -49,9 +49,8 @@
         {
                 tsk::handle< bool > h(
                         tsk::async(
- tsk::own_thread(),
- tsk::make_task(
- runs_in_pool_fn) ) );
+ tsk::make_task( runs_in_pool_fn),
+ tsk::own_thread() ) );
                 BOOST_CHECK_EQUAL( h.get(), false);
         }
 
@@ -75,9 +74,8 @@
         {
                 tsk::handle< void > h(
                         tsk::async(
- tsk::own_thread(),
- tsk::make_task(
- throwing_fn) ) );
+ tsk::make_task( throwing_fn),
+ tsk::own_thread() ) );
                 BOOST_CHECK_THROW( h.get(), std::runtime_error);
         }
 
@@ -89,8 +87,8 @@
                 BOOST_CHECK_THROW( h.wait(), tsk::task_uninitialized);
                 BOOST_CHECK_THROW( h.wait_for( pt::seconds( 1) ), tsk::task_uninitialized);
                 BOOST_CHECK_THROW(
- h.wait_until( boost::get_system_time() + pt::seconds( 1) ),
- tsk::task_uninitialized);
+ h.wait_until( boost::get_system_time() + pt::seconds( 1) ),
+ tsk::task_uninitialized);
                 BOOST_CHECK( ! h.is_ready() );
                 BOOST_CHECK( ! h.has_value() );
                 BOOST_CHECK( ! h.has_exception() );
@@ -101,10 +99,10 @@
         {
                 tsk::handle< void > h(
                         tsk::async(
- tsk::own_thread(),
                                 tsk::make_task(
                                         delay_fn,
- pt::seconds( 3) ) ) );
+ pt::seconds( 3) ),
+ tsk::own_thread() ) );
                 h.interrupt();
                 BOOST_CHECK( h.interruption_requested() );
                 BOOST_CHECK_NO_THROW( h.get() );
@@ -116,11 +114,11 @@
                 bool finished( false);
                 tsk::handle< void > h(
                         tsk::async(
- tsk::own_thread(),
                                 tsk::make_task(
                                         interrupt_fn,
                                         pt::seconds( 3),
- boost::ref( finished) ) ) );
+ boost::ref( finished) ),
+ tsk::own_thread() ) );
                 h.interrupt_and_wait();
                 BOOST_CHECK( ! finished);
                 BOOST_CHECK( h.is_ready() );
@@ -135,10 +133,10 @@
                 for ( int i = 0; i <= 5; ++i)
                         vec.push_back(
                                 tsk::async(
- tsk::own_thread(),
                                         tsk::make_task(
                                                 fibonacci_fn,
- i) ) );
+ i),
+ tsk::own_thread() ) );
                 tsk::waitfor_all( vec.begin(), vec.end() );
                 BOOST_CHECK( vec[0].is_ready() );
                 BOOST_CHECK( vec[1].is_ready() );
@@ -159,16 +157,16 @@
         {
                 tsk::handle< void > h1(
                         tsk::async(
- tsk::own_thread(),
                                 tsk::make_task(
                                         delay_fn,
- pt::seconds( 3) ) ) );
+ pt::seconds( 3) ),
+ tsk::own_thread() ) );
                 tsk::handle< int > h2(
                         tsk::async(
- tsk::own_thread(),
                                 tsk::make_task(
                                         fibonacci_fn,
- 10) ) );
+ 10),
+ tsk::own_thread() ) );
                 tsk::waitfor_any( h1, h2);
                 BOOST_CHECK( h1.is_ready() );
                 BOOST_CHECK( h2.is_ready() );

Modified: sandbox/task/libs/task/test/test_unbounded_pool.cpp
==============================================================================
--- sandbox/task/libs/task/test/test_unbounded_pool.cpp (original)
+++ sandbox/task/libs/task/test/test_unbounded_pool.cpp 2009-06-04 15:18:27 EDT (Thu, 04 Jun 2009)
@@ -49,10 +49,10 @@
> pool( tsk::poolsize( 1) );
                 tsk::handle< int > h(
                         tsk::async(
- pool,
                                 tsk::make_task(
                                         fibonacci_fn,
- 10) ) );
+ 10),
+ pool) );
                 BOOST_CHECK_EQUAL( h.get(), 55);
         }
 
@@ -64,9 +64,8 @@
> pool( tsk::poolsize( 1) );
                 tsk::handle< bool > h(
                         tsk::async(
- pool,
- tsk::make_task(
- runs_in_pool_fn) ) );
+ tsk::make_task( runs_in_pool_fn),
+ pool) );
                 BOOST_CHECK_EQUAL( h.get(), true);
         }
 
@@ -100,10 +99,10 @@
> pool( tsk::poolsize( 1) );
                 tsk::handle< int > h(
                         tsk::async(
- pool,
                                 tsk::make_task(
                                         fibonacci_fn,
- 10) ) );
+ 10),
+ pool) );
                 pool.shutdown();
                 BOOST_CHECK( pool.closed() );
                 BOOST_CHECK_EQUAL( h.get(), 55);
@@ -117,9 +116,8 @@
> pool( tsk::poolsize( 1) );
                 tsk::handle< void > h(
                         tsk::async(
- pool,
- tsk::make_task(
- throwing_fn) ) );
+ tsk::make_task( throwing_fn),
+ pool) );
                 pool.shutdown();
                 BOOST_CHECK_THROW( h.get(), std::runtime_error);
         }
@@ -134,11 +132,11 @@
                 BOOST_CHECK( pool.closed() );
                 BOOST_CHECK_THROW(
                         tsk::async(
- pool,
                                 tsk::make_task(
                                         boost::bind(
                                                 fibonacci_fn,
- 10) ) ),
+ 10) ),
+ pool),
                         tsk::task_rejected);
         }
 
@@ -150,10 +148,10 @@
> pool( tsk::poolsize( 1) );
                 tsk::handle< void > h(
                         tsk::async(
- pool,
                                 tsk::make_task(
                                         delay_fn,
- pt::millisec( 500) ) ) );
+ pt::millisec( 500) ),
+ pool) );
                 boost::this_thread::sleep( pt::millisec( 250) );
                 BOOST_CHECK_EQUAL( pool.size(), std::size_t( 1) );
                 pool.shutdown_now();
@@ -174,26 +172,26 @@
                 boost::barrier b( 2);
                 tsk::handle< void > h1(
                         tsk::async(
- pool,
                                 tsk::make_task(
                                         barrier_fn,
- boost::ref( b) ) ) );
+ boost::ref( b) ),
+ pool) );
                 boost::this_thread::sleep( pt::millisec( 250) );
                 BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 0) );
                 tsk::handle< int > h2(
                         tsk::async(
- pool,
                                 tsk::make_task(
                                         fibonacci_fn,
- 10) ) );
+ 10),
+ pool) );
                 boost::this_thread::sleep( pt::millisec(250) );
                 BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 1) );
                 tsk::handle< int > h3(
                         tsk::async(
- pool,
                                 tsk::make_task(
                                         fibonacci_fn,
- 10) ) );
+ 10),
+ pool) );
                 boost::this_thread::sleep( pt::millisec(250) );
                 BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 2) );
                 b.wait();
@@ -218,17 +216,17 @@
                 std::vector< int > buffer;
                 tsk::handle< void > h(
                         tsk::async(
- pool,
                                 tsk::make_task(
                                         buffer_fibonacci_fn,
                                         boost::ref( buffer),
- 10) ) );
+ 10),
+ pool) );
                 tsk::async(
- pool,
                         tsk::make_task(
                                 buffer_fibonacci_fn,
                                 boost::ref( buffer),
- 0) );
+ 0),
+ pool);
                 h.interrupt();
                 b.wait();
                 pool.shutdown();
@@ -247,23 +245,23 @@
                 pool_type pool( tsk::poolsize( 1) );
                 boost::barrier b( 2);
                 tsk::async(
- pool,
                         tsk::make_task(
                                 barrier_fn,
- boost::ref( b) ) );
+ boost::ref( b) ),
+ pool);
                 std::vector< int > buffer;
                 tsk::async(
- pool,
                         tsk::make_task(
                                 buffer_fibonacci_fn,
                                 boost::ref( buffer),
- 10) );
+ 10),
+ pool);
                 tsk::async(
- pool,
                         tsk::make_task(
                                 buffer_fibonacci_fn,
                                 boost::ref( buffer),
- 0) );
+ 0),
+ pool);
                 b.wait();
                 pool.shutdown();
                 BOOST_CHECK_EQUAL( buffer[0], 55);
@@ -283,26 +281,26 @@
                 pool_type pool( tsk::poolsize( 1) );
                 boost::barrier b( 2);
                 tsk::async(
- pool,
                         tsk::make_task(
                                 barrier_fn,
                                 boost::ref( b) ),
- 0);
+ 0,
+ pool);
                 std::vector< int > buffer;
                 tsk::async(
- pool,
                         tsk::make_task(
                                 buffer_fibonacci_fn,
                                 boost::ref( buffer),
                                 10),
- 1);
+ 1,
+ pool);
                 tsk::async(
- pool,
                         tsk::make_task(
                                 buffer_fibonacci_fn,
                                 boost::ref( buffer),
                                 0),
- 0);
+ 0,
+ pool);
                 b.wait();
                 pool.shutdown();
                 BOOST_CHECK_EQUAL( buffer[0], 0);
@@ -328,26 +326,26 @@
                         0);
                 std::vector< int > buffer;
                 tsk::async(
- pool,
                         tsk::make_task(
                                 buffer_fibonacci_fn,
                                 boost::ref( buffer),
                                 10),
- 2);
+ 2,
+ pool);
                 tsk::async(
- pool,
                         tsk::make_task(
                                 buffer_fibonacci_fn,
                                 boost::ref( buffer),
                                 0),
- 1);
+ 1,
+ pool);
                 tsk::async(
- pool,
                         tsk::make_task(
                                 buffer_fibonacci_fn,
                                 boost::ref( buffer),
                                 1),
- 2);
+ 2,
+ pool);
                 b.wait();
                 pool.shutdown();
                 BOOST_CHECK_EQUAL( buffer[0], 0);


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