Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54112 - in sandbox/task: boost/task boost/task/detail libs/task/doc libs/task/doc/html libs/task/test
From: oliver.kowalke_at_[hidden]
Date: 2009-06-19 16:44:00


Author: olli
Date: 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
New Revision: 54112
URL: http://svn.boost.org/trac/boost/changeset/54112

Log:
* docu updated
* processor binding for FreeBSD
* move ops. for task

Removed:
   sandbox/task/libs/task/doc/async_executor.qbk
   sandbox/task/libs/task/doc/default_pool.qbk
   sandbox/task/libs/task/doc/html/
   sandbox/task/libs/task/doc/ref_meta_functions.qbk
   sandbox/task/libs/task/doc/ref_stacksize.qbk
   sandbox/task/libs/task/doc/ref_this_task.qbk
Text files modified:
   sandbox/task/boost/task/detail/bind_processor_freebsd.hpp | 34 ++++++---
   sandbox/task/boost/task/detail/config.hpp | 2
   sandbox/task/boost/task/static_pool.hpp | 18 +++++
   sandbox/task/boost/task/task.hpp | 51 ++++++++++---
   sandbox/task/libs/task/doc/acknowledgements.qbk | 2
   sandbox/task/libs/task/doc/as_sub_task.qbk | 8 +
   sandbox/task/libs/task/doc/async.qbk | 19 ++--
   sandbox/task/libs/task/doc/boost_task.qbk | 8 -
   sandbox/task/libs/task/doc/fork_join.qbk | 42 +++++++----
   sandbox/task/libs/task/doc/handle.qbk | 63 ++++++++++------
   sandbox/task/libs/task/doc/introduction.qbk | 109 +++++++++++++++++++----------
   sandbox/task/libs/task/doc/new_thread.qbk | 19 +++-
   sandbox/task/libs/task/doc/overview.qbk | 34 ++++----
   sandbox/task/libs/task/doc/own_thread.qbk | 10 +
   sandbox/task/libs/task/doc/pool.qbk | 44 ++++--------
   sandbox/task/libs/task/doc/processor_binding.qbk | 12 ++-
   sandbox/task/libs/task/doc/ref_async.qbk | 18 ++--
   sandbox/task/libs/task/doc/ref_exceptions.qbk | 144 ++++++++++++++++++++++++++++++++++++++++
   sandbox/task/libs/task/doc/ref_handle.qbk | 12 ---
   sandbox/task/libs/task/doc/ref_new_thread.qbk | 8 +-
   sandbox/task/libs/task/doc/ref_own_thread.qbk | 8 +-
   sandbox/task/libs/task/doc/ref_static_pool.qbk | 127 ++++++++++++++++++++++++++--------
   sandbox/task/libs/task/doc/ref_task.qbk | 113 +++++++++++++++++++++++-------
   sandbox/task/libs/task/doc/scheduler.qbk | 30 +++++---
   sandbox/task/libs/task/doc/shutdown.qbk | 30 +++++---
   sandbox/task/libs/task/doc/static_pool.qbk | 1
   sandbox/task/libs/task/doc/task.qbk | 94 ++++++++++++++++++-------
   sandbox/task/libs/task/doc/todo.qbk | 9 --
   sandbox/task/libs/task/test/test_bounded_pool.cpp | 6 +
   sandbox/task/libs/task/test/test_task.cpp | 21 +++++
   sandbox/task/libs/task/test/test_unbounded_pool.cpp | 6 +
   31 files changed, 768 insertions(+), 334 deletions(-)

Modified: sandbox/task/boost/task/detail/bind_processor_freebsd.hpp
==============================================================================
--- sandbox/task/boost/task/detail/bind_processor_freebsd.hpp (original)
+++ sandbox/task/boost/task/detail/bind_processor_freebsd.hpp 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -9,7 +9,8 @@
 
 extern "C"
 {
-
+#include <sys/param.h>
+#include <sys/cpuset.h>
 }
 
 #include <boost/assert.hpp>
@@ -26,21 +27,32 @@
                 BOOST_ASSERT( n >= 0);
                 BOOST_ASSERT( n < boost::thread::hardware_concurrency() );
 
-// if ( ::processor_bind( P_LWPID, P_MYID, static_cast< processorid_t >( n), 0) == -1)
-// throw boost::system::system_error(
-// boost::system::error_code(
-// errno,
-// boost::system::system_category) );
+ cpusetid_t cpusetid;
+ CPU_ZERO( & cpusetid);
+ CPU_SET( n, & cpusetid);
+
+ if ( ::cpuset_setid( CPU_WHICH_TID, -1, cpusetid) == -1)
+ throw boost::system::system_error(
+ boost::system::error_code(
+ errno,
+ boost::system::system_category) );
         }
 
         inline
         void bind_to_any_processor()
         {
-// if ( ::processor_bind( P_LWPID, P_MYID, PBIND_NONE, 0) == -1)
-// throw boost::system::system_error(
-// boost::system::error_code(
-// errno,
-// boost::system::system_category) );
+ cpusetid_t cpusetid;
+ CPU_ZERO( & cpusetid);
+
+ unsigned int max( boost::thread::hardware_concurrency() );
+ for ( unsigned int i( 0); i < max; ++i)
+ CPU_SET( i, & cpuset);
+
+ if ( ::cpuset_setid( CPU_WHICH_TID, -1, cpusetid) == -1)
+ throw boost::system::system_error(
+ boost::system::error_code(
+ errno,
+ boost::system::system_category) );
         }
 }}
 

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-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -19,7 +19,7 @@
 # pragma warn -8066 // Unreachable code
 # endif
 
-# if defined(BOOST_TASK_DYN_DLL) || defined(BOOST_ALL_DYN_LINK)
+# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_TASK_DYN_LINK)
 # undef BOOST_TASK_USE_LIB
 # define BOOST_TASK_USE_DLL
 # endif

Modified: sandbox/task/boost/task/static_pool.hpp
==============================================================================
--- sandbox/task/boost/task/static_pool.hpp (original)
+++ sandbox/task/boost/task/static_pool.hpp 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -54,6 +54,11 @@
 
         friend class detail::worker;
 
+# if defined(BOOST_MSVC) && (BOOST_MSVC < 1500) // < MSVC 9.0
+ template< typename Pool >
+ friend class detail::worker::impl_pool;
+# endif
+
         typedef typename channel::item channel_item;
         
 # if defined(BOOST_HAS_PROCESSOR_BINDINGS)
@@ -64,6 +69,11 @@
         {
         private:
                 friend class detail::worker;
+
+# if defined(BOOST_MSVC) && (BOOST_MSVC < 1500) // < MSVC 9.0
+ template< typename Pool >
+ friend class detail::worker::impl_pool;
+# endif
         
                 detail::worker_group wg_;
                 shared_mutex mtx_wg_;
@@ -537,6 +547,14 @@
                 return pool_->submit( t, attr);
         }
 
+ typedef typename shared_ptr< pool_base >::unspecified_bool_type unspecified_bool_type;
+
+ operator unspecified_bool_type() const // throw()
+ { return pool_; }
+
+ bool operator!() const // throw()
+ { return ! pool_; }
+
         void swap( static_pool & other) // throw()
         { pool_.swap( other.pool_); }
 };

Modified: sandbox/task/boost/task/task.hpp
==============================================================================
--- sandbox/task/boost/task/task.hpp (original)
+++ sandbox/task/boost/task/task.hpp 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -10,6 +10,7 @@
 #include <boost/bind.hpp>
 #include <boost/config.hpp>
 #include <boost/thread.hpp>
+#include <boost/utility/enable_if.hpp>
 
 #include <boost/task/future.hpp>
 #include <boost/task/exceptions.hpp>
@@ -29,7 +30,7 @@
 class task_base
 {
 protected:
- bool done_;
+ bool done_;
 
 protected:
         promise< R > prom_;
@@ -179,28 +180,25 @@
 
         friend struct as_sub_task;
 
+ struct dummy;
+
         shared_ptr< detail::task_base< R > > task_;
 
 public:
         task()
         : task_()
         {}
-
- template< typename Fn >
- explicit task( Fn const& fn)
- : task_( new detail::task_wrapper< R, Fn >( fn) )
- {}
-
+
         explicit task( R( * fn)())
         : task_( new detail::task_wrapper< R, R( *)() >( fn) )
         {}
-
+
+# if defined(BOOST_HAS_RVALUE_REFS)
         template< typename Fn >
- explicit task( boost::detail::thread_move_t< Fn > fn)
+ task( Fn && fn)
         : task_( new detail::task_wrapper< R, Fn >( fn) )
         {}
 
-# if defined(BOOST_HAS_RVALUE_REFS)
         task( task && other)
         : task_()
         { task_.swap( other.task_); }
@@ -215,6 +213,22 @@
         task && move()
         { return static_cast< task && >( * this); }
 # else
+#ifdef BOOST_NO_SFINAE
+ template< typename Fn >
+ explicit task( Fn fn)
+ : task_( new detail::task_wrapper< R, Fn >( fn) )
+ {}
+#else
+ template< typename Fn >
+ explicit task( Fn fn, typename disable_if< boost::is_convertible< Fn &, boost::detail::thread_move_t< Fn > >, dummy * >::type = 0)
+ : task_( new detail::task_wrapper< R, Fn >( fn) )
+ {}
+#endif
+ template< typename Fn >
+ task( boost::detail::thread_move_t< Fn > fn)
+ : task_( new detail::task_wrapper< R, Fn >( fn) )
+ {}
+
         task( boost::detail::thread_move_t< task > other)
         : task_()
         { task_.swap( other->task_); }
@@ -226,6 +240,9 @@
             return * this;
         }
 
+ boost::detail::thread_move_t< task > move()
+ { return boost::detail::thread_move_t< task >( * this); }
+
         operator boost::detail::thread_move_t< task >()
         { return boost::detail::thread_move_t< task >( * this); }
 # endif
@@ -237,9 +254,6 @@
                 return task_->get_future();
         }
 
- void swap( task & other) // throw()
- { task_.swap( other.task_); }
-
         void operator()()
         {
                 if ( ! task_)
@@ -254,6 +268,17 @@
                         throw task_moved();
                 task_->set_wait_callback( cb);
         }
+
+ typedef typename shared_ptr< detail::task_base< R > >::unspecified_bool_type unspecified_bool_type;
+
+ operator unspecified_bool_type() const // throw()
+ { return task_; }
+
+ bool operator!() const // throw()
+ { return ! task_; }
+
+ void swap( task & other) // throw()
+ { task_.swap( other.task_); }
 };
 }
 

Modified: sandbox/task/libs/task/doc/acknowledgements.qbk
==============================================================================
--- sandbox/task/libs/task/doc/acknowledgements.qbk (original)
+++ sandbox/task/libs/task/doc/acknowledgements.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -8,7 +8,7 @@
 
 [section:acknowledgements Appendix B: Acknowledgments]
 
-I'd like to thank Vicente J. Botet Escriba for his contributions (default_pool, reschedule_until, sleep, yield) and Anthony Williams and Braddock Gaskill for their future libraries.
+I'd like to thank Vicente J. Botet Escriba for his contributions (reschedule_until, sleep, yield) an comments and Anthony Williams and Braddock Gaskill for their future libraries.
 
 
 [endsect]

Modified: sandbox/task/libs/task/doc/as_sub_task.qbk
==============================================================================
--- sandbox/task/libs/task/doc/as_sub_task.qbk (original)
+++ sandbox/task/libs/task/doc/as_sub_task.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -13,11 +13,13 @@
 
 
 ``
+ boost::task::task< long > t(
+ boost::bind(
+ fibonacci,
+ 10) );
         boost::task::handle< long > h(
                 boost::task::async(
- boost::task::make_task(
- fibonacci,
- 10),
+ boost::move( t),
                         boost::task::as_sub_task() ) );
 ``
 

Modified: sandbox/task/libs/task/doc/async.qbk
==============================================================================
--- sandbox/task/libs/task/doc/async.qbk (original)
+++ sandbox/task/libs/task/doc/async.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -8,8 +8,8 @@
 
 [section:async Asynchronous execution]
 
-The function __fn_async__ passes the __task__ to the __ep__ which executes the __task__ (for this purpose __ep__ is
-required to provide `handle< R > operator()( task< R > tsk)`).
+Function __fn_async__ applies the moved __task__ to the __ep__ which executes the __task__ (for this purpose __ep__ is
+required to provide `handle< R > operator()( task< R > && tsk)`).
 __fn_async__ accepts two arguments - the first is an __task__ object and the second an __ep__. For the second argument
 __as_sub_task__ is used per default. The function returns a __handle__ which controls the submitted __task__.
 
@@ -31,13 +31,14 @@
 
         void main()
         {
- boost::task::handle< long > h( // get handle associated with the task
- boost::task::async(
- boost::task::make_task( // compute fibonacci(10) asynchron
- fibonacci,
- 10) ) );
- std::cout << "id == " << h.get_id() << "\n";
- std::cout << "fibonacci(10) == " << h.get() << std::endl; // throws boost::task::task_interrupted
+ boost::task< long > t( // task -> compute fibonacci(10)
+ boost::bind(
+ fibonacci,
+ 10) );
+ boost::task::handle< long > h( // move the task to execution-policy functor
+ boost::task::async( // and return a handle
+ boost::move( t) );
+ std::cout << "fibonacci(10) == " << h.get() << std::endl; // access the result
         }
 ``
 

Deleted: sandbox/task/libs/task/doc/async_executor.qbk
==============================================================================
--- sandbox/task/libs/task/doc/async_executor.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
+++ (empty file)
@@ -1,22 +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
-]
-
-
-[section:async_executor Asynchronous executor]
-
-In contrast to synchronous methods asynchronous methods do not block the program flow when a time consuming operation is executed.
-The application continues executing the current context and when the result of the asynchronous method is required the __act__ can be used.
-
-An __ae__ executes a __task__ asynchronously and provides a link_handle(__act__) to manage the __task__.
-
-[include own_thread.qbk]
-[include new_thread.qbk]
-[include pool.qbk]
-[include as_sub_task.qbk]
-
-
-[endsect]

Modified: sandbox/task/libs/task/doc/boost_task.qbk
==============================================================================
--- sandbox/task/libs/task/doc/boost_task.qbk (original)
+++ sandbox/task/libs/task/doc/boost_task.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -41,12 +41,10 @@
 [def __as_sub_task__ `boost::task::as_sub_task`]
 [def __attribute_type__ `boost::task::attribute_type`]
 [def __bounded_channel__ `boost::task::bounded_channel`]
-[def __default_pool__ `boost::task::default_pool`]
 [def __dynamic_pool__ `boost::task::dynamic_pool`]
 [def __handle__ `boost::task::handle`]
 [def __has_attribute__ `boost::task::has_attribute`]
 [def __hwm__ `boost::task::high_watermark`]
-[def __id__ `boost::task::id`]
 [def __lwm__ `boost::task::low_watermark`]
 [def __new_thread__ `boost::task::new_thread`]
 [def __own_thread__ `boost::task::own_thread`]
@@ -63,8 +61,6 @@
 [def __waitfor_all__ `boost::task::waitfor_all()`]
 [def __waitfor_any__ `boost::task::waitfor_any()`]
 
-[def __full_default_pool__ `boost::task::static_pool< boost::task::unbounded_channel< boost::task::fifo > >`]
-
 [def __fn_delay__ `boost::this_task::delay()`]
 [def __fn_get_pool__ `boost::this_task::get_pool()`]
 [def __fn_tt_interrupt__ `boost::this_task::interrupt()`]
@@ -76,14 +72,13 @@
 [def __fn_yield__ `boost::this_task::yield()`]
 
 [def __fn_async__ `boost::task::async()`]
-[def __fn_default_pool__ `boost::task::default_pool()`]
 
 [def __fn_active__ `active()`]
+[def __fn_bind_to_processors__ `bind_to_processors()`]
 [def __fn_closed__ `close()`]
 [def __fn_clear__ `clear()`]
 [def __fn_empty__ `empty()`]
 [def __fn_get__ `get()`]
-[def __fn_get_id__ `get_id()`]
 [def __fn_get_future__ `get_future()`]
 [def __fn_has_value__ `has_value()`]
 [def __fn_has_exception__ `has_exception()`]
@@ -103,6 +98,7 @@
 [def __fn_wait_for__ `wait_for()`]
 [def __fn_wait_until__ `wait_until()`]
 
+
 [def __act__ ['asynchronous-completion-token]]
 [def __ep__ ['execution-policy]]
 [def __eps__ ['execution-policies]]

Deleted: sandbox/task/libs/task/doc/default_pool.qbk
==============================================================================
--- sandbox/task/libs/task/doc/default_pool.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
+++ (empty file)
@@ -1,52 +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
-]
-
-
-[section:default_pool Default pool]
-
-The library provides a default-pool accessible via __fn_default_pool__. The function returns a reference to
-__full_default_pool__. The static instance of __default_pool__ contains as many __worker_threads__ as
-__hardware_concurrency__ returns, queues unlimited amount of tasks and schedules the tasks in FIFO-order.
-
-
-``
- long fibonacci_fn( long n)
- {
- if ( n == 0) return 0;
- if ( n == 1) return 1;
- long k1( 1), k2( 0);
- for ( int i( 2); i <= n; ++i)
- {
- long tmp( k1);
- k1 = k1 + k2;
- k2 = tmp;
- }
- return k1;
- }
-
- void main()
- {
- std::cout << "worker-threads running in default-pool == " << boost::task::default_pool().size() << "\n";
-
- boost::task::handle< long > h1(
- boost::task::async(
- boost::task::make_task( fibonacci_fn, 10),
- boost::task::default_pool() ) ); // execution-policy == default-pool
-
- boost::task::handle< long > h2(
- boost::task::async(
- boost::task::make_task( fibonacci_fn, 5),
- boost::task::default_pool() ) ); // execution-policy == default-pool
-
- std::cout << "fibonacci(10) == " << h1.get() << "\n";
- std::cout << "fibonacci(5) == " << h2.get() << std::endl;
- }
-``
-
-
-[endsect]
-

Modified: sandbox/task/libs/task/doc/fork_join.qbk
==============================================================================
--- sandbox/task/libs/task/doc/fork_join.qbk (original)
+++ sandbox/task/libs/task/doc/fork_join.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -12,7 +12,7 @@
 enough to solve using simple, short sequential methods, so that they run in parallel on multiple cores.
 
 The fork operation creates new __sub_tasks__ which can run in parallel. The current __task__ is not proceeded in the join operation
-until the forked __sub_tasks__ have completed. In the meantime the __worker_thread__ executes other tasks from its local worker-queue.
+until the forked __sub_tasks__ have completed. In the meantime the __worker_thread__ executes other tasks from its local __worker_queue__.
 
 ``
         long serial_fib( long n)
@@ -27,20 +27,20 @@
                 else
                 {
                         // fork a sub-task calculating fibonacci(n-1)
- h1 = boost::task::async(
- boost::task::make_task(
+ boost::task::task< long > t1(
+ boost::bind(
                                         parallel_fib,
                                         n - 1,
- cutof),
- boost::task::as_sub_task() );
-
+ cutof) );
                         // fork a sub-task calculating fibonacci(n-2)
- h2 = boost::task::async(
- boost::task::make_task(
+ boost::task< long > t2(
+ boost::bind(
                                         parallel_fib,
                                         n - 2,
- cutof),
- boost::task::as_sub_task() );
+ cutof) );
+
+ h1 = boost::task::async( boost::move( t1) );
+ h2 = boost::task::async( boost::move( t2) );
 
                         // join the results of both sub-tasks
                         // if one of the both sub-tasks is not ready
@@ -52,13 +52,23 @@
 
         void main()
         {
- boost::task::handle< long > h( // handle for fibonacci calculation
+ boost::task::static_pool<
+ boost::task::unbounded_channel<
+ boost::task::fifo
+ >
+ > pool( boost::task::poolsize( 5) );
+
+ boost::task::task< long > t(
+ boost::bind( // calculate fibonacci number 10
+ parallel_fib, // for numbers < 5 do inline recursive calculation
+ 10,
+ 5) );
+
+ boost::task::handle< long > h( // handle for fibonacci calculation
                         boost::task::async(
- boost::task::make_task( // calculate fibonacci number 10
- parallel_fib, // for numbers < 5 do inline recursive calculation
- 10,
- 5),
- boost::task::default_pool() ) ); // access the default thread-pool
+ boost::move( t),
+ pool) ); // execute in the thread-pool
+
                 std::cout << h.get() << std::endl;
         }
 ``

Modified: sandbox/task/libs/task/doc/handle.qbk
==============================================================================
--- sandbox/task/libs/task/doc/handle.qbk (original)
+++ sandbox/task/libs/task/doc/handle.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -19,8 +19,6 @@
 
 __handle__ implements an interface in order to check the state of computation and to transfer the result.
 
-* __fn_get_id__: return id of the associated __task_id__
-
 * __fn_is_ready__: test if result is set
 
 * __fn_has_value__: test if value-result is set
@@ -52,13 +50,16 @@
 
         void main()
         {
+ boost::task::task< long > t(
+ boost::bind(
+ fibonacci,
+ 10) );
+
                 boost::task::handle< long > h(
                         boost::task::async(
- boost::task::make_task(
- fibonacci,
- 10),
+ boost::move( t),
                                 boost::task::new_thread() ) );
- std::cout << "id == " << h.get_id() << "\n";
+
                 std::cout << "is ready == " << std::boolalpha << h.is_ready() << "\n";
                 h.wait();
                 std::cout << "has value == " << std::boolalpha << h.has_value() << "\n";
@@ -109,14 +110,18 @@
 
         void main()
         {
+ boost::task::task< long > t(
+ boost::bind( // task, to be executed asynchronously
+ cooperative,
+ 10) );
+
                 boost::task::handle< long > h( // get handle associated with the task
                         boost::task::async(
- boost::task::make_task( // task, to be executed asynchronously
- cooperative,
- 10),
+ boost::move( t),
                                 boost::task::new_thread() ) ); // asynchronous executor
+
                 h.interrupt_and_wait();
- std::cout << "id == " << h.get_id() << "\n";
+
                 std::cout << "is ready == " << std::boolalpha << h.is_ready() << "\n";
                 std::cout << "has value == " << std::boolalpha << h.has_value() << "\n";
                 std::cout << "has exception == " << std::boolalpha << h.has_exception() << "\n";
@@ -139,11 +144,16 @@
                 results.reserve( 10);
 
                 for ( int i = 0; i < 10; ++i)
+ {
+ boost::task::task< long > t(
+ boost::bind(
+ fibonacci,
+ 10) );
+
                         results.push_back(
                                 boost::task::async(
- boost::task::make_task(
- fibonacci,
- 10) ) ) );
+ boost::move( t) ) );
+ }
 
                 // wait until all tasks are ready
                 boost::task::waitfor_all( results.begin(), results.end() );
@@ -165,23 +175,28 @@
 ``
         void main()
         {
+ boost::task::task< long > t1(
+ boost::bind(
+ cooperative,
+ 10) );
+ boost::task::task< long > t2(
+ boost::bind(
+ cooperative,
+ 7) );
+ boost::task::task< long > t3(
+ boost::bind(
+ cooperative,
+ 5) );
+
                 boost::task::handle< long > h1(
                         boost::task::async(
- boost::task::make_task(
- cooperative,
- 10) ) );
-
+ boost::move( t1) ) );
                 boost::task::handle< long > h2(
                         boost::task::async(
- boost::task::make_task(
- cooperative,
- 7) ) );
-
+ boost::move( t2) ) );
                 boost::task::handle< long > h3(
                         boost::task::async(
- boost::task::make_task(
- cooperative,
- 5) ) );
+ boost::move( t3) ) );
 
                 // wait for any task becomes ready
                 boost::task::waitfor_any( h1, h2, h3);

Modified: sandbox/task/libs/task/doc/introduction.qbk
==============================================================================
--- sandbox/task/libs/task/doc/introduction.qbk (original)
+++ sandbox/task/libs/task/doc/introduction.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -32,15 +32,18 @@
 
         void main()
         {
- boost::task::async( // dispatchs task
- boost::task::make_task( // task, to be executed asynchronously
+ boost::task::task< void > t( // task, to be executed asynchronously
+ boost::bind(
                                 print,
- "Hello World!"),
+ "Hello World!") );
+
+ boost::task::async( // dispatchs task,
+ boost::move( t), // move task to executor
                         boost::task::new_thread() ) ); // execution-policy
         }
 ``
 
-In order to manage the task __fn_async__ returns a handle __handle__ (associated with the submitted task). It functions as a __act__ -
+In order to manage the task __fn_async__ returns a __handle__ (associated with the submitted task). It functions as a __act__ -
 that means it transfers the result of the execution back to the caller thread.
 
 ``
@@ -49,12 +52,16 @@
 
         void main()
         {
- boost::task::handle< std::string > h( // get handle associated with the task
- boost::task::async(
- boost::task::make_task( // task, to be executed asynchronously
- echo,
- "Hello World!"),
- boost::task::new_thread() ) ); // execution-policy
+ boost::task::task< std::string > t( // task returning the submitted string
+ boost::bind(
+ echo,
+ "Hello World!") );
+
+ boost::task::handle< std::string > h(
+ boost::task::async(
+ boost::move( t), // move task to executor
+ boost::task::new_thread() ) ); // execute task in a new thread
+
                 std::cout << h.get() << std::endl; // wait until task is finished and return the result
         }
 ``
@@ -67,20 +74,24 @@
 
         void main()
         {
- boost::task::handle< std::string > h( // get handle associated with the task
+ boost::task::task< void > t( // long runing task
+ boost::bind(
+ long_running,
+ boost::posix_time::millisec( 500) ) );
+
+ boost::task::handle< std::string > h(
                         boost::task::async(
- boost::task::make_task( // long runing task, to be executed asynchronously
- long_running,
- boost::posix_time::millisec( 500) ),
- boost::task::new_thread() ) ); // execution-policy
+ boost::move( t),
+ boost::task::new_thread() ) );
+
                 h.interrupt(); // interrupt execution of task
- std::cout << h.get() << std::endl; // wait until task is finished, will throw an exeception
+
+ std::cout << h.get() << std::endl; // wait until task is finished, will throw an task_interrupted exeception
         }
 ``
 
-Beside __new_thread__ (which creates a new task for each submitted task) __boost_task__ provides [link_pool __thread_pools__]
-to prevent the overhead of thread creation and destruction for each task. __default_pool__ submitts the tasks to the default
-__thread_pool__ which contains a fixed number of pre-spawned __worker_threads__ (custom __thread_pools__ are supported too).
+Beside __new_thread__ (which creates a new task for each submitted task - the thread will be joined by __handle__) __boost_task__ provides [link_pool __thread_pools__]
+to prevent the overhead of thread creation and destruction of threads for each task (__thread_pools__ can be customized).
 
 ``
         long serial_fib( long n)
@@ -95,20 +106,26 @@
                 else
                 {
                         // fork a sub-task calculating fibonacci(n-1)
- h1 = boost::task::async(
- boost::task::make_task(
+ boost::task::task< long > t1(
+ boost::bind(
                                         parallel_fib,
                                         n - 1,
- cutof),
- boost::this_task::get_pool() );
-
+ cutof) );
                         // fork a sub-task calculating fibonacci(n-2)
- h2 = boost::task::async(
- boost::task::make_task(
+ boost::task::task< long > t2(
+ boost::bind(
                                         parallel_fib,
                                         n - 2,
- cutof),
- boost::this_task::get_pool() );
+ cutof) );
+
+ boost::task::handle< long > h1(
+ boost::task::async(
+ boost::move( t1),
+ boost::this_task::get_pool() ) );
+ boost::task::handle< long > h2(
+ boost::task::async(
+ boost::move( t2),
+ boost::this_task::get_pool() ) );
 
                         // join the results of both sub-tasks
                         return h1.get() + h2.get();
@@ -117,13 +134,23 @@
 
         void main()
         {
- boost::task::handle< long > h( // handle for fibonacci calculation
+ boost::task::static_pool<
+ boost::task::unbounded_channel<
+ boost::task::fifo
+ >
+ > pool( boost::task::poolsize( 5) );
+
+ boost::task::task< long > t( // task calculates fibonacci-number for 10
+ boost::bind(
+ parallel_fib,
+ 10,
+ 5) );
+
+ boost::task::handle< long > h( // handle of async. executed task
                         boost::task::async(
- boost::task::make_task( // calculate fibonacci number 10
- parallel_fib, // for numbers < 5 do inline recursive calculation
- 10,
- 5),
- boost::task::default_pool() ) ); // access the default thread-pool
+ boost::move( t),
+ boost::task::default_pool() ) ); // thread-pool
+
                 std::cout << h.get() << std::endl;
         }
 ``
@@ -134,12 +161,16 @@
 [link_work_stealing __work_stealing__] and [link_forkjoin inline execution] of tasks.
 
 ``
- boost::task::async(
- boost::task::make_task( // the thread-pool depending upon the parent
- parallel_fib, // task is executed inside a thread-pool or not
+ boost::task::task< long > t(
+ boost::bind(
+ parallel_fib,
                         10,
- 5),
- boost::task::as_sub_task() ) ); // sub-task executed in a new thread or inside
+ 5) );
+
+ boost::task::async(
+ boost::move( t),
+ boost::task::as_sub_task() ); // sub-task executed in a new thread or inside a thread-pool
 ``
 
+
 [endsect]

Modified: sandbox/task/libs/task/doc/new_thread.qbk
==============================================================================
--- sandbox/task/libs/task/doc/new_thread.qbk (original)
+++ sandbox/task/libs/task/doc/new_thread.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -32,12 +32,16 @@
 
         void main()
         {
+ boost::task::task< long > t(
+ boost::bind(
+ fibonacci,
+ 10) );
+
                 boost::task::handle< long > h(
                         boost::task::async(
- boost::task::make_task(
- fibonacci,
- 10),
+ boost::move( t),
                                 boost::task::new_thread() ) );
+
                 std::cout << "fibonacci(10) == " << h.get() << std::endl;
         }
 ``
@@ -50,15 +54,18 @@
 for synchronous execution)!
 
 ``
+ boost::task::task< void > t1( a_function);
+ boost::task::task< void > t2( another_function);
+
         boost::task::async(
- boost::task::make_task( a_function),
+ boost::move( t1),
                 boost::task::new_thread() ) );
-
         boost::task::async(
- boost::task::make_task( another_function),
+ boost::move( t2),
                 boost::task::new_thread() ) );
 ``
 
+
 [endsect]
  
  

Modified: sandbox/task/libs/task/doc/overview.qbk
==============================================================================
--- sandbox/task/libs/task/doc/overview.qbk (original)
+++ sandbox/task/libs/task/doc/overview.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -11,13 +11,11 @@
 __boost_task__ provides an framework for parallel execution of tasks (a task is a small unit of code that can be executed independently).
 
 * __task__, __callable__ representing a fine-grained work-item:
- * __fn_get_id__ returning an identifier
         * __fn_operator__ to execute the fine-grained work-item
         * __fn_get_future__ providing an __act__ in order to pass the result (values, exceptions) back to initiator
 
 * __handle__, __act__ of the asynchronously executed task:
- * __fn_get_id__ for identifying associated task
- * __fn_interrupt__, interrupt_and_wait() allow to cancel an cooperative task
+ * __fn_interrupt__, __fn_interrupt_and_wait__, ... allow to cancel an cooperative task
         * interface of __act__:
                 * __fn_get__ retrieve value or exception of task execution
                 * __fn_is_ready__ test if task was executed
@@ -30,11 +28,10 @@
 * __ep__ models:
         * __own_thread__: executes task in current thread.
         * __new_thread__: executes task in a newly created thread (thread will be destroyed after)
- * __default_pool__: task gets executed by a __worker_thread__ of the default __thread_pool__
         * __as_sub_task__: executes task in newly created thread or in a pool of __worker_threads__ depending on whether current task is already executed in a pool
- * custom pool: task gets executed by a __worker_thread__ of a custom __thread_pool__ (for instance with priority scheduling)
+ * __thread_pool__: task gets executed by a __worker_thread__ of a custom __thread_pool__ (for instance with priority or smart scheduling)
 
-* __thread_pools__ with work-stealing algorithm
+* __thread_pools__ with work-stealing algorithm and for/join semantics
 
 * support of forking and joining sub-tasks
         * better performance
@@ -78,18 +75,22 @@
 
         void main()
         {
+ boost::task< long > t1(
+ boost::bind(
+ fibonacci,
+ 10) );
+ boost::task< long > t2(
+ boost::bind(
+ fibonacci,
+ 5) );
+
                 boost::task::handle< long > h1(
                         boost::task::async(
- boost::task::make_task(
- fibonacci,
- 10) ) );
+ boost::move( t1), tsk::new_thread() );
                 boost::task::handle< long > h2(
                         boost::task::async(
- boost::task::make_task(
- fibonacci,
- 5) ) );
- std::cout << "h1: id == " << h1.get_id() << "\n";
- std::cout << "h2: id == " << h2.get_id() << "\n";
+ boost::move( t2), tsk::new_thread() );
+
                 std::cout << "h1: is ready == " << std::boolalpha << h1.is_ready() << "\n";
                 std::cout << "h2: is ready == " << std::boolalpha << h2.is_ready() << "\n";
                 boost::task::waitfor_all( h1, h2);
@@ -133,13 +134,12 @@
 * Windows XP Professional (x86), MSVC 9.0
 
 
-[heading How to build]
+[heading How to build and install]
 
 * download the sources form [@http://www.boostpro.com/vault/index.php boost-vault] (section ['Concurrent Programing]) or the latest development version from
 [@https://svn.boost.org/svn/boost/sandbox/task/ boost-sandbox]
 * extract the archive into the boost-source directory
-* change directory to <boost-source>/libs/task/build
-* call `bjam toolset=<compiler-name>`
+* call `bjam toolset=<compiler-name> --with-task install` in order to install __boost_task__
 
 
 [endsect]

Modified: sandbox/task/libs/task/doc/own_thread.qbk
==============================================================================
--- sandbox/task/libs/task/doc/own_thread.qbk (original)
+++ sandbox/task/libs/task/doc/own_thread.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -27,12 +27,16 @@
 
         void main()
         {
+ boost::task::task< long > t(
+ boost::bind(
+ fibonacci,
+ 10) );
+
                 boost::task::handle< long > h(
                         boost::task::async(
- boost::task::make_task(
- fibonacci,
- 10),
+ boost::move( t),
                                 boost::task::own_thread() ) );
+
                 std::cout << "fibonacci(10) == " << h.get() << std::endl;
         }
 ``

Modified: sandbox/task/libs/task/doc/pool.qbk
==============================================================================
--- sandbox/task/libs/task/doc/pool.qbk (original)
+++ sandbox/task/libs/task/doc/pool.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -14,7 +14,7 @@
 
 A __thread_pool__ maintains a queue (or queues) of __work_items__ to be done, and a pool of __worker_threads__ which execute __work_items__ from the queue(s).
 
-__boost_task__ provides __fn_async__ with support of executing an __task__ in __default_pool__ (using __fn_default_pool__):
+__boost_task__ provides __fn_async__ with support of executing an __task__ in __thread_pool__:
 
 
 ``
@@ -23,50 +23,36 @@
 
         void main()
         {
- boost::task::handle< std::string > h(
- boost::task::async(
- boost::task::make_task(
- echo,
- "Hello World!"),
- boost::task::default_pool() ) );
- std::cout << h.get() << std::endl;
- }
-``
+ boost::task::static_pool<
+ boost::task::unbounded_channel<
+ boost::task::fifo
+ >
+ > pool( boost::task::poolsize( 5) );
+
+ boost::task::task< std::string > t(
+ boost::bind(
+ echo,
+ "Hello World!") );
 
-and a custom __thread_pool__ (passing pool instance as an argument to __fn_async__):
-
-
-``
- std::string echo( std::string const& msg)
- { return msg; }
-
- boost::task::static_pool<
- boost::task::unbounded_channel<
- boost::task::fifo
- >
- > pool( boost::task::poolsize( 5) );
-
- void main()
- {
                 boost::task::handle< std::string > h(
                         boost::task::async(
- boost::task::make_task(
- echo,
- "Hello World!"),
+ boost::move( t),
                                 pool) );
+
                 std::cout << h.get() << std::endl;
         }
 ``
 
+
 [important Tasks should not be too small (performance overhead dominates) and avoid blocking
 tasks[footnote see [@http://www.ddj.com/go-parallel/article/showArticle.jhtml?articleID=216500409
 'Use Thread Pools Correctly'], Herb Sutter].]
 
+
 [include static_pool.qbk]
 [include channel.qbk]
 [include scheduler.qbk]
 [include shutdown.qbk]
-[include default_pool.qbk]
 [include processor_binding.qbk]
 [include work_stealing.qbk]
 [include fork_join.qbk]

Modified: sandbox/task/libs/task/doc/processor_binding.qbk
==============================================================================
--- sandbox/task/libs/task/doc/processor_binding.qbk (original)
+++ sandbox/task/libs/task/doc/processor_binding.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -8,17 +8,21 @@
 
 [section:processor_binding Processor binding]
 
-For some applications it is convenient to bind the __worker_threads__ to processors/cores of the system. For this purpose __pool_size__ must not be given to the constructor so that a __worker_thread__ is created an bound the the core.
+For some applications it is convenient to bind the __worker_threads__ to processors/cores of the system. For this purpose __fn_bind_to_processors__ must
+be given to constructor instead __pool_size__ so that a __worker_thread__ is created an bound the the core.
 
 ``
- boost::task::static_pool<
+ // constructs thread-pool with worker-threads as hardware_concurrency() returns
+ typedef boost::task::static_pool<
                 boost::task::unbounded_channel< boost::tp::fifo >
- > pool; // constructs thread-pool with worker-threads as hardware_concurrency() returns
+ > pool_type;
+
+ pool_type pool( pool_type::bind_to_processors() );
 ``
 
 The constructor takes additional arguments for the link_work_stealing[work-stealing algorithm] and link_channel[high-] and link_channel[low-watermark] too.
 
-[note __boost_task__ does provide this feature only for Windows, Linux, AIX, HP-UX and Solaris.]
+[note __boost_task__ does provide this feature only for Windows, Linux, AIX, HP-UX, Solaris and FreeBSD.]
 
 
 [endsect]

Modified: sandbox/task/libs/task/doc/ref_async.qbk
==============================================================================
--- sandbox/task/libs/task/doc/ref_async.qbk (original)
+++ sandbox/task/libs/task/doc/ref_async.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -6,51 +6,51 @@
 ]
 
 
-[section:async Non-member function `async( task< R >, EP)`]
+[section:async Non-member function `async( task< R > &&, EP)`]
 
 ``
         #include <boost/task/async.hpp>
 
         template< typename R, typename EP >
- handle< R > async( task< R > t, EP ep);
+ handle< R > async( task< R > && t, EP ep);
 ``
 
 [variablelist
-[[Effects:] [executes task in an asyncrounous executer and returns a handle associated with the task]]
+[[Effects:] [moves task to an asyncrounous executer and returns a handle associated with the task]]
 [[Throws:] [`boost::thread_resource_error`]]
 ]
 
 [endsect]
 
 
-[section:async1 Non-member function `async( task< R >, pool< Channel > &)`]
+[section:async1 Non-member function `async( task< R > &&, pool< Channel > &)`]
 
 ``
         #include <boost/task/async.hpp>
 
         template< typename R, typename Channel >
- handle< R > async( task< R > t, pool< Channel > & ep);
+ handle< R > async( task< R > && t, pool< Channel > & ep);
 ``
 
 [variablelist
-[[Effects:] [executes task in a thread-pool and returns a handle associated with the task]]
+[[Effects:] [moves task into a thread-pool and returns a handle associated with the task]]
 [[Throws:] [`boost::task::task_rejected`]]
 ]
 
 [endsect]
 
 
-[section:async2 Non-member function `async( task< R >, Attr, pool< Channel > &)`]
+[section:async2 Non-member function `async( task< R > &&, Attr, pool< Channel > &)`]
 
 ``
         #include <boost/task/async.hpp>
 
         template< typename R, typename Channel, typename Attr >
- handle< R > async( task< R > t, Attr attr, pool< Channel > & ep);
+ handle< R > async( task< R > && t, Attr attr, pool< Channel > & ep);
 ``
 
 [variablelist
-[[Effects:] [executes atrributed task in a thread-pool and returns a handle associated with the task]]
+[[Effects:] [moves attributed task into a thread-pool and returns a handle associated with the task]]
 [[Throws:] [`boost::task::task_rejected`]]
 ]
 

Modified: sandbox/task/libs/task/doc/ref_exceptions.qbk
==============================================================================
--- sandbox/task/libs/task/doc/ref_exceptions.qbk (original)
+++ sandbox/task/libs/task/doc/ref_exceptions.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -125,3 +125,147 @@
 
 [endsect]
 
+
+[section:task_unitialized Class `task_unitialized`]
+
+``
+ #include <boost/task/exceptions.hpp>
+
+ class task_unitialized : public std::logic_error
+ {
+ public:
+ task_unitialized();
+ };
+``
+
+[heading Constructor]
+
+ task_unitialized()
+
+[variablelist
+[[Effects:] [Constructs a `boost::task::task_unitialized` instance.]]
+[[Throws:] [Nothing]]
+]
+
+[endsect]
+
+
+[section:task_already_executed Class `task_already_executed`]
+
+``
+ #include <boost/task/exceptions.hpp>
+
+ class task_already_executed : public std::logic_error
+ {
+ public:
+ task_already_executed();
+ };
+``
+
+[heading Constructor]
+
+ task_already_executed()
+
+[variablelist
+[[Effects:] [Constructs a `boost::task::task_already_executed` instance.]]
+[[Throws:] [Nothing]]
+]
+
+[endsect]
+
+
+[section:task_moved Class `task_moved`]
+
+``
+ #include <boost/task/exceptions.hpp>
+
+ class task_moved : public std::logic_error
+ {
+ public:
+ task_moved();
+ };
+``
+
+[heading Constructor]
+
+ task_moved()
+
+[variablelist
+[[Effects:] [Constructs a `boost::task::task_moved` instance.]]
+[[Throws:] [Nothing]]
+]
+
+[endsect]
+
+
+[section:broken_task Class `broken_task`]
+
+``
+ #include <boost/task/exceptions.hpp>
+
+ class broken_task : public std::logic_error
+ {
+ public:
+ broken_task();
+ };
+``
+
+[heading Constructor]
+
+ broken_task()
+
+[variablelist
+[[Effects:] [Constructs a `boost::task::broken_task` instance.]]
+[[Throws:] [Nothing]]
+]
+
+[endsect]
+
+
+[section:task_interrupted Class `task_interrupted`]
+
+``
+ #include <boost/task/exceptions.hpp>
+
+ class task_interrupted : public std::runtime_error
+ {
+ public:
+ task_interrupted();
+ };
+``
+
+[heading Constructor]
+
+ task_interrupted()
+
+[variablelist
+[[Effects:] [Constructs a `boost::task::task_interrupted` instance.]]
+[[Throws:] [Nothing]]
+]
+
+[endsect]
+
+
+[section:pool_moved Class `pool_moved`]
+
+``
+ #include <boost/task/exceptions.hpp>
+
+ class pool_moved : public std::logic_error
+ {
+ public:
+ pool_moved();
+ };
+``
+
+[heading Constructor]
+
+ pool_moved()
+
+[variablelist
+[[Effects:] [Constructs a `boost::task::pool_moved` instance.]]
+[[Throws:] [Nothing]]
+]
+
+[endsect]
+

Modified: sandbox/task/libs/task/doc/ref_handle.qbk
==============================================================================
--- sandbox/task/libs/task/doc/ref_handle.qbk (original)
+++ sandbox/task/libs/task/doc/ref_handle.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -15,8 +15,6 @@
         {
                 handle();
 
- const id get_id() const;
-
                 void interrupt();
 
                 void interrupt_and_wait();
@@ -84,16 +82,6 @@
 ]
 
 
-[heading Member function `get_id()`]
-
- const id get_id() const
-
-[variablelist
-[[Effects:] [returns identifier of the associated task]]
-[[Throws:] [Nothing]]
-]
-
-
 [heading Member function `interruption_requested()`]
 
         bool interruption_requested()

Deleted: sandbox/task/libs/task/doc/ref_meta_functions.qbk
==============================================================================
--- sandbox/task/libs/task/doc/ref_meta_functions.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
+++ (empty file)
@@ -1,36 +0,0 @@
-[/
- (C) Copyright 2008 Oliver Kowalke.
- 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).
-]
-
-[section:has_priority Meta function `has_priority`]
-
- #include <boost/tp/info.hpp>
-
- template< typename Pool >
- struct has_priority
- :
- public mpl::bool_<
- is_same<
- detail::has_priority,
- typename Pool::scheduler_type::priority_tag_type
- >::value
- >
- {};
-
-[endsect]
-
-
-[section:priority_type Meta function `priority_type`]
-
- #include <boost/tp/info.hpp>
-
- template< typename Pool >
- struct priority_type
- {
- typedef typename Pool::scheduler_type::attribute_type type;
- };
-
-[endsect]

Modified: sandbox/task/libs/task/doc/ref_new_thread.qbk
==============================================================================
--- sandbox/task/libs/task/doc/ref_new_thread.qbk (original)
+++ sandbox/task/libs/task/doc/ref_new_thread.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -14,17 +14,17 @@
         struct new_thread
         {
                 template< typename R >
- handle< R > operator()( task< R > t);
+ handle< R > operator()( task< R > &&);
         };
 ``
 
-[heading Member function `operator()( task< R > t)`]
+[heading Member function `operator()( task< R > &&)`]
 
         template< typename R >
- handle< R > operator()( task< R > t)
+ handle< R > operator()( task< R > && t)
 
 [variablelist
-[[Effects:] [executes task in a new thread an returns an handle associated with the task]]
+[[Effects:] [moves task in a new thread an returns an handle associated with the task]]
 [[Throws:] [`boost::thread_resource_error`]]
 ]
 

Modified: sandbox/task/libs/task/doc/ref_own_thread.qbk
==============================================================================
--- sandbox/task/libs/task/doc/ref_own_thread.qbk (original)
+++ sandbox/task/libs/task/doc/ref_own_thread.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -14,17 +14,17 @@
         struct own_thread
         {
                 template< typename R >
- handle< R > operator()( task< R > t);
+ handle< R > operator()( task< R > && t);
         };
 ``
 
-[heading Member function `operator()( task< R > t)`]
+[heading Member function `operator()( task< R > &&)`]
 
         template< typename R >
- handle< R > operator()( task< R > t)
+ handle< R > operator()( task< R > && t)
 
 [variablelist
-[[Effects:] [executes task in the current thread an returns an handle associated with the task]]
+[[Effects:] [moves task in the current thread an returns an handle associated with the task]]
 [[Throws:] [Nothing]]
 ]
 

Deleted: sandbox/task/libs/task/doc/ref_stacksize.qbk
==============================================================================
--- sandbox/task/libs/task/doc/ref_stacksize.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
+++ (empty file)
@@ -1,41 +0,0 @@
-[/
- (C) Copyright 2008 Oliver Kowalke.
- 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).
-]
-
-[section:stacksize Class `stacksize`]
-
- #include <boost/tp/stacksize.hpp>
-
- class stacksize
- {
- public:
- explicit stacksize( std::size_t value);
-
- operator std::size_t () const;
- };
-
-[heading Constructor]
-
- explicit stacksize( std::size_t value);
-
-[variablelist
-[[Preconditions:][value > 0]]
-[[Effects:] [Constructs a `boost::tp::stacksize` instance.]]
-[[Postconditions:][operator std::size_t () > 0]]
-[[Throws:] [`boost::tp::invalid_stacksize`]]
-]
-
-[heading Member function `operator std::size_t()`]
-
- operator std::size_t () const;
-
-[variablelist
-[[Effects:] [Returns stack size.]]
-[[Throws:] [Nothing]]
-]
-
-
-[endsect]

Modified: sandbox/task/libs/task/doc/ref_static_pool.qbk
==============================================================================
--- sandbox/task/libs/task/doc/ref_static_pool.qbk (original)
+++ sandbox/task/libs/task/doc/ref_static_pool.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -15,28 +15,39 @@
         class static_pool : private noncopyable
         {
         public:
- explicit pool(
+ static_pool();
+
+ explicit static_pool(
                         poolsize const& psize,
                         posix_time::time_duration const& asleep = posix_time::microseconds( 10),
                         scanns const& scns = scanns( 20) );
 
- explicit pool(
+ explicit static_pool(
                         poolsize const& psize,
                         high_watermark const& hwm,
                         low_watermark const& lwm,
                         posix_time::time_duration const& asleep = posix_time::milliseconds( 100),
                         scanns const& scns = scanns( 20) );
 
+ static_pool( static_pool &&);
+
+ static_pool & operator=( static_pool &&);
 
- explicit pool(
+# if defined(BOOST_HAS_PROCESSOR_BINDINGS)
+ explicit static_pool(
+ <<unspec-type>>,
                         posix_time::time_duration const& asleep = posix_time::microseconds( 10),
                         scanns const& scns = scanns( 20) );
 
- explicit pool(
+ explicit static_pool(
+ <<unspec-type>>,
                         high_watermark const& hwm,
                         low_watermark const& lwm,
                         posix_time::time_duration const& asleep = posix_time::milliseconds( 100),
                         scanns const& scns = scanns( 20) );
+
+ static <<unspec-type>> bind_to_processors();
+# endif
 
                 ~static_pool();
 
@@ -58,24 +69,37 @@
                 void lower_bound( low_watermark const& lwm);
 
                 template< typename R >
- handle< R > submit( task< R > t);
+ handle< R > submit( task< R > && t);
 
                 template< typename R, typename Attr >
- handle< R > submit( task< R > t, Attr const& attr);
+ handle< R > submit( task< R > && t, Attr const& attr);
+
+ void swap( static_pool & other); // throw()
         };
 ``
 
+[heading Default constructor]
+
+ static_pool()
+
+[variablelist
+[[Effects:] [constructs an unitialized pool]]
+[[Throws:] [nothing]]
+]
+
+
 [heading Constructor (unbounded channel)]
 
         explicit static_pool(
+ <<unspec-type>>,
                 posix_time::time_duration const& asleep = posix_time::microseconds( 10),
                 scanns const& scns = scanns( 20) )
 
 [variablelist
-[[Preconditions:] [operating system provides functionality for processor pining]]
+[[Preconditions:] [operating system provides functionality for processor binding]]
 [[Effects:] [constructs a pool - for each processor a worker-thread is created and bound to one processor - global-queue can queue an unlimited number of tasks]]
 [[Throws:] [`boost::thread_resource_error`, `boost::task::invalid_scanns`, `boost::task::invalid_timeduration`]]
-[[Notes:] [constructor has to be called if a unbounded-channel is used]]
+[[Notes:] [constructor has to be called if a unbounded-channel is used and `bind_to_processors()` must be set as first argument]]
 ]
 
 
@@ -96,16 +120,17 @@
 [heading Constructor (bounded channel)]
 
         explicit static_pool(
+ <<unspec-type>>,
                 high_watermark const& hwm,
                 low_watermark const& lwm,
                 posix_time::time_duration const& asleep = posix_time::milliseconds( 100),
                 scanns const& scns = scanns( 20) )
 
 [variablelist
-[[Preconditions:] [operating system provides functionality for processor pining]]
+[[Preconditions:] [operating system provides functionality for processor binding]]
 [[Effects:] [constructs a pool - for each processor a worker-thread is created and bound to one processor - global-queue can only queue a limited number of tasks]]
 [[Throws:] [`boost::thread_resource_error`, `boost::task::invalid_scanns`, `boost::task::invalid_timeduration`, `boost::task::invalid_watermark`]]
-[[Notes:] [constructor has to be called if a bounded-channel is used]]
+[[Notes:] [constructor has to be called if a bounded-channel is used and `bind_to_processors()` must be set as first argument]]
 ]
 
 
@@ -125,6 +150,26 @@
 ]
 
 
+[heading Move-copy constructor]
+
+ static_pool( static_pool &&)
+
+[variablelist
+[[Effects:] [creates an pool out of another one which gets zeroed out]]
+[[Throws:] [nothing]]
+]
+
+
+[heading Move-assigment constructor]
+
+ static_pool & operator=( static_pool &&)
+
+[variablelist
+[[Effects:] [creates an pool out of another one which gets zeroed out]]
+[[Throws:] [nothing]]
+]
+
+
 [heading Destructor]
 
         ~static_pool()
@@ -135,13 +180,23 @@
 ]
 
 
+[heading Static member function `bind_to_processors()`]
+
+ <<unspec-type>> bind_to_processors()
+
+[variablelist
+[[Effects:] [used in order to let the pool create worker-threads as cores are available and bound the threads to the cores]]
+[[Throws:] [nothing]]
+]
+
+
 [heading Member function `size()`]
 
         std::size_t size()
 
 [variablelist
 [[Effects:] [returns how many worker-threads are running in the pool]]
-[[Throws:] [nothing]]
+[[Throws:] [`boost::task::pool_moved`]]
 ]
 
 
@@ -151,7 +206,7 @@
 
 [variablelist
 [[Effects:] [returns how many worker-threads are active (executing an task)]]
-[[Throws:] [nothing]]
+[[Throws:] [`boost::task::pool_moved`]]
 ]
 
 
@@ -161,7 +216,7 @@
 
 [variablelist
 [[Effects:] [returns how many worker-threads are idle (not executing an task).]]
-[[Throws:] [nothing]]
+[[Throws:] [`boost::task::pool_moved`]]
 [[Notes:] [the value is the difference of `size()` and `active()`]]
 ]
 
@@ -172,7 +227,7 @@
 
 [variablelist
 [[Effects:] [deactivates the channel and joins all worker-threads - the pool is closed]]
-[[Throws:] [`boost::thread_interrupted`, `boost::system::system_error`]]
+[[Throws:] [`boost::thread_interrupted`, `boost::system::system_error`, `boost::task::pool_moved`]]
 [[Notes:] [all pending tasks are processed]]
 ]
 
@@ -183,7 +238,7 @@
 
 [variablelist
 [[Effects:] [deactivates the channel, send interruption request to all worker-threads and joins them - the pool is closed]]
-[[Throws:] [`boost::thread_interrupted`, `boost::system::system_error`]]
+[[Throws:] [`boost::thread_interrupted`, `boost::system::system_error`, `boost::task::pool_moved`]]
 [[Notes:] [pending tasks are not processed but returned]]
 ]
 
@@ -194,7 +249,7 @@
 
 [variablelist
 [[Effects:] [queries if the pool is closed (pool is shutdown)]]
-[[Throws:] [nothing]]
+[[Throws:] [`boost::task::pool_moved`]]
 ]
 
 
@@ -204,7 +259,7 @@
 
 [variablelist
 [[Effects:] [removes all pending tasks from the channel]]
-[[Throws:] [nothing]]
+[[Throws:] [`boost::task::pool_moved`]]
 ]
 
 
@@ -214,7 +269,7 @@
 
 [variablelist
 [[Effects:] [queries if the channel is empty]]
-[[Throws:] [nothing]]
+[[Throws:] [`boost::task::pool_moved`]]
 ]
 
 
@@ -224,7 +279,7 @@
 
 [variablelist
 [[Effects:] [queries how many tasks are pending (still unprocessed) in the global-queue (channel)]]
-[[Throws:] [nothing]]
+[[Throws:] [`boost::task::pool_moved`]]
 ]
 
 
@@ -235,7 +290,7 @@
 [variablelist
 [[Preconditions:] [channel is of type bounded-channel]]
 [[Effects:] [returns the upper bound of the bounded-channel]]
-[[Throws:] [nothing]]
+[[Throws:] [`boost::task::pool_moved`]]
 [[Notes:] [can only be used if a bounded-channel is used]]
 ]
 
@@ -248,7 +303,7 @@
 [[Preconditions:] [channel is of type bounded-channel]]
 [[Effects:] [sets the upper bound of the bounded-channel]]
 [[Postconditions:] [`this->upper_bound() == hwm`]]
-[[Throws:] [`boost::task::invalid_watermark`]]
+[[Throws:] [`boost::task::invalid_watermark`, `boost::task::pool_moved`]]
 [[Notes:] [can only be used if a bounded-channel is used]]
 ]
 
@@ -260,7 +315,7 @@
 [variablelist
 [[Preconditions:] [channel is of type bounded-channel]]
 [[Effects:] [returns the lower bound of the bounded-channel]]
-[[Throws:] [nothing]]
+[[Throws:] [`boost::task::pool_moved`]]
 [[Notes:] [can only be used if a bounded-channel is used]]
 ]
 
@@ -273,32 +328,42 @@
 [[Preconditions:] [channel is of type bounded-channel]]
 [[Effects:] [sets the lower bound of the bounded-channel]]
 [[Postconditions:] [`this->lower_bound() == lwm`]]
-[[Throws:] [`boost::task::invalid_watermark`]]
+[[Throws:] [`boost::task::invalid_watermark`, `boost::task::pool_moved`]]
 [[Notes:] [can only be used if a bounded-channel is used]]
 ]
 
 
-[heading Member function `submit( Act const& act)`]
+[heading Member function `submit( task< R > &&)`]
 
         template< typename R >
- handle< R > submit( task< R > const& t)
+ handle< R > submit( task< R > && t)
 
 [variablelist
 [[Preconditions:] [has_attribute< pool >::value == false && ! closed()]]
-[[Effects:] [submits an task to the pool and returns an associated handle]]
-[[Throws:] [`boost::task::task_rejected`]]
+[[Effects:] [moves an task to the pool and returns an associated handle]]
+[[Throws:] [`boost::task::task_rejected`, `boost::task::pool_moved`]]
 ]
 
 
-[heading Member function `submit( Act const& act, Attr const& attr)`]
+[heading Member function `submit( task< R > &&, Attr const& attr)`]
 
         template< typename R, typename Attr >
- handle< R > submit( task< R > const& t, Attr const& attr)
+ handle< R > submit( task< R > && t, Attr const& attr)
 
 [variablelist
 [[Preconditions:] [has_attribute< pool >::value == true && ! closed()]]
-[[Effects:] [submits an task to the pool and returns an associated handle - task is scheduled by the attribute]]
-[[Throws:] [`boost::task::task_rejected`]]
+[[Effects:] [moves an task to the pool and returns an associated handle - task is scheduled by the attribute]]
+[[Throws:] [`boost::task::task_rejected`, `boost::task::pool_moved`]]
+]
+
+
+[heading Member function swap( static_pool &)`]
+
+ void swap( static_pool & other)
+
+[variablelist
+[[Effects:] [swaps pool]]
+[[Throws:] [nothing]]
 ]
 
 

Modified: sandbox/task/libs/task/doc/ref_task.qbk
==============================================================================
--- sandbox/task/libs/task/doc/ref_task.qbk (original)
+++ sandbox/task/libs/task/doc/ref_task.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -11,29 +11,41 @@
         #include <boost/task/task.hpp>
 
         template< typename R >
- class task
+ class task : private noncopyable
         {
         public:
+ task();
+
+ task( R( * fn)());
+
                 template< typename Fn >
- task( Fn const& fn);
+ task( Fn fn);
 
- const id get_id() const;
+ task( task && t);
+ task & operator=( task && t);
+
+ task && move();
 
                 shared_future< R > & get_future();
 
- void swap( task< R > & other) // throw();
+ void operator()();
+
+ template< typename Cb >
+ void set_wait_callback( Cb const& cb);
 
- void operator()() // throw();
+ void swap( task< R > & other); // throw()
         };
+``
 
- template< typename Fn, typename A0 >
- task< R >::type > make_task( Fn fn, A0 a0);
+[heading Default constructor]
 
- ...
+ task()
+
+[variablelist
+[[Effects:] [constructs an unitialized `boost::task::task< R >`]]
+[[Throws:] [Nothing]]
+]
 
- template< typename Fn, typename A0, ..., typename A10 >
- task< R >::type > make_task( Fn fn, A0 a0, ..., A10 a10);
-``
 
 [heading Constructor]
 
@@ -41,37 +53,57 @@
         task( Fn const& fn)
 
 [variablelist
-[[Effects:] [constructs a `boost::tp::task< R >` from a function object]]
+[[Effects:] [constructs a `boost::task::task< R >` from a function object]]
 [[Throws:] [Nothing]]
 ]
 
 
-[heading function `get_id()`]
+[heading Constructor]
 
- const id get_id() const
+ task( R( * fn)());
 
 [variablelist
-[[Effects:] [returns task identifier]]
+[[Effects:] [constructs a `boost::task::task< R >` from a function pointer]]
 [[Throws:] [Nothing]]
 ]
 
 
-[heading Member function `get_future()`]
+[heading Move-copy constructor]
 
- shared_future< R > & get_future()
+ task( task &&)
 
 [variablelist
-[[Effects:] [returns a future assiciated with the task]]
+[[Effects:] [constructs a `boost::task::task< R >` from another task taking over the ownership]]
 [[Throws:] [Nothing]]
 ]
 
 
-[heading Member function `swap()`]
+[heading Move-assignment constructor]
 
- void swap( task< R > & other)
+ task & operator=( task &&)
 
 [variablelist
-[[Effects:] [swaps the task]]
+[[Effects:] [constructs a `boost::task::task< R >` from another task taking over the ownership]]
+[[Throws:] [Nothing]]
+]
+
+
+[heading Member function `move()`]
+
+ task && move()
+
+[variablelist
+[[Effects:] [moves task releasing the ownership]]
+[[Throws:] [Nothing]]
+]
+
+
+[heading Member function `get_future()`]
+
+ shared_future< R > & get_future()
+
+[variablelist
+[[Effects:] [returns a future assiciated with the task]]
 [[Throws:] [Nothing]]
 ]
 
@@ -86,18 +118,43 @@
 ]
 
 
-[heading Free function `make_task()`]
+[heading Member template-function `set_wait_callback( Cb cons&)`]
+
+ template< typename Cb >
+ void set_wait_callback( Cb const cb&);
+
+[variablelist
+[[Effects:] [stores callback function object which will be called if task would block]]
+[[Throws:] [Nothing]]
+]
+
+
+[heading Member function `swap( task< R > &)`]
+
+ void swap( task< R > & other)
+
+[variablelist
+[[Effects:] [swaps the task]]
+[[Throws:] [Nothing]]
+]
+
+
+[heading operator `operator unspecified_bool_type()`]
+
+ operator unspecified_bool_type() const // throw()
+
+[variablelist
+[[Effects:] [is task valid == does task own ownership]]
+[[Throws:] [Nothing]]
+]
 
- template< typename Fn, typename A0 >
- task< R >::type > make_task( Fn fn, A0 a0);
 
- ...
+[heading operator `operator!()`]
 
- template< typename Fn, typename A0, ..., typename A10 >
- task< R >::type > make_task( Fn fn, A0 a0, ..., A10 a10);
+ bool operator!() const // throw()
 
 [variablelist
-[[Effects:] [creates an task from function object and arguments]]
+[[Effects:] [is task invalid == does task not own ownership]]
 [[Throws:] [Nothing]]
 ]
 

Deleted: sandbox/task/libs/task/doc/ref_this_task.qbk
==============================================================================
--- sandbox/task/libs/task/doc/ref_this_task.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
+++ (empty file)
@@ -1,64 +0,0 @@
-[/
- (C) Copyright 2008 Oliver Kowalke.
- 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).
-]
-
-[section:reschedule_until Non-member function `reschedule_until()`]
-
- #include <boost/tp/pool.hpp>
-
- template< typename Pred >
- void reschedule_until( Pred const&);
-
-[variablelist
-[[Effects:] [Reschedules current task until passed callable predicate becomes ready.]
-[[Throws:] [Nothing.]]
-[[Note:] [This function resides in namespace `boost::this_task`.]]
-]
-
-[endsect]
-
-[section:get_thread_pool Non-member function `get_thread_pool()`]
-
- #include <boost/tp/pool.hpp>
-
- template< typename Pool >
- Pool & get_thread_pool();
-
-[variablelist
-[[Effects:] [Returns reference to the thread pool where the current worker thread is running.]
-[[Throws:] [Nothing.]]
-[[Note:] [This function resides in namespace `boost::this_task`.]]
-]
-
-[endsect]
-
-[section:is_worker Non-member function `is_worker()`]
-
- #include <boost/tp/pool.hpp>
-
- bool is_worker();
-
-[variablelist
-[[Effects:] [Returns true if the current thread is a worker-thread form a pool.]
-[[Throws:] [Nothing.]]
-[[Note:] [This function resides in namespace `boost::this_task`.]]
-]
-
-[endsect]
-
-[section:worker_id Non-member function `worker_id()`]
-
- #include <boost/tp/pool.hpp>
-
- thread::id worker_id();
-
-[variablelist
-[[Effects:] [Returns returns the thread-id of the worker-thread.]
-[[Throws:] [Nothing.]]
-[[Note:] [This function resides in namespace `boost::this_task`.]]
-]
-
-[endsect]

Modified: sandbox/task/libs/task/doc/scheduler.qbk
==============================================================================
--- sandbox/task/libs/task/doc/scheduler.qbk (original)
+++ sandbox/task/libs/task/doc/scheduler.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -26,15 +26,17 @@
                         boost::task::priority< int > > // tasks with lower priority are scheduled first
> pool( boost::task::poolsize( 5) );
 
- boost::task::async(
- boost::task::make_task( some_fn), // task to be executed
- 5, // priority is 5
- pool); // thread-pool
+ boost::task::task< void > t1( some_fn); // task to be executed
+ boost::task::task< void > t2( another_fn); // task to be executed
 
         boost::task::async(
- boost::task::make_task( another_fn), // task to be executed
- 3, // priority is 3
- pool); // thread-pool
+ boost::move( t1),
+ 5, // priority is 5
+ pool); // thread-pool
+ boost::task::async(
+ boost::move( t2), // task to be executed
+ 3, // priority is 3
+ pool); // thread-pool
 ``
 
 In this example the tasks get scheduled by the assigned integer (third argument of __fn_async__). The __task__ with the
@@ -90,18 +92,22 @@
 
                 ...
 
+ boost::task::task< long > t1(
+ boost::bind( fibonacci_fn, 10) );
+ boost::task::task< long > t2(
+ boost::bind( fibonacci_fn, 5) );
+
                 // replaced by later task with same attribute == 2
                 // if still pending in pool
                 boost::task::async(
- boost::task::make_task( fibonacci_fn, 10),
- 2, // attribute is 2
+ boost::move( t1),
+ 2,
                         pool);
 
                 // will replace previous pending task with attribute == 2
                 boost::task::async(
- pool,
- boost::task::make_task( fibonacci_fn, 5),
- 2, // attribute is 2 too
+ boost::move( t2),
+ 2,
                         pool);
         }
 ``

Modified: sandbox/task/libs/task/doc/shutdown.qbk
==============================================================================
--- sandbox/task/libs/task/doc/shutdown.qbk (original)
+++ sandbox/task/libs/task/doc/shutdown.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -45,17 +45,21 @@
 
                 ...
 
+ boost::task::task< long > t1(
+ boost::bind( fibonacci_fn, 10) );
+ boost::task::task< long > t2(
+ boost::bind( fibonacci_fn, 5) );
+
                 boost::task::handle< long > h1(
                         boost::task::async(
- boost::task::make_task( fibonacci_fn, 10),
- pool) ); // execution-policy
-
+ boost::move( t1),
+ pool) );
                 boost::task::handle< long > h2(
                         boost::task::async(
- boost::task::make_task( fibonacci_fn, 5),
- pool) ); // execution-policy
+ boost::move( t2),
+ pool) );
 
- pool.shutdown();
+ pool.shutdown(); // waits until all pending tasks are finished
 
                 std::cout << "fibonacci(10) == " << h1.get() << "\n";
                 std::cout << "fibonacci(5) == " << h2.get() << std::endl;
@@ -97,15 +101,19 @@
 
                 ...
 
+ boost::task::task< long > t1(
+ boost::bind( fibonacci_fn, 10) );
+ boost::task::task< long > t2(
+ boost::bind( fibonacci_fn, 5) );
+
                 boost::task::handle< long > h1(
                         boost::task::async(
- boost::task::make_task( fibonacci_fn, 10),
- pool) ); // execution-policy
-
+ boost::move( t1),
+ pool) );
                 boost::task::handle< long > h2(
                         boost::task::async(
- boost::task::make_task( fibonacci_fn, 5),
- pool) ); // execution-policy
+ boost::move( t2),
+ pool) );
 
                 pool.shutdown_now();
 

Modified: sandbox/task/libs/task/doc/static_pool.qbk
==============================================================================
--- sandbox/task/libs/task/doc/static_pool.qbk (original)
+++ sandbox/task/libs/task/doc/static_pool.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -9,6 +9,7 @@
 [section:static_pool Static thread-pool]
 
 __boost_task__ provides __static_pool__ - which contains an fixed set of pre-forked __worker_threads__ (the size of the pool doesn't change during its lifetime).
+__static_pool__ supports move semantics.
 
 
 ``

Modified: sandbox/task/libs/task/doc/task.qbk
==============================================================================
--- sandbox/task/libs/task/doc/task.qbk (original)
+++ sandbox/task/libs/task/doc/task.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -12,7 +12,7 @@
 
 __task__ represents a __callable__ (provides __fn_operator__) object containing the unit of code to be execute by a __ep__.
 Function __fn_get_future__ returns a __act__ allowing to wait for the completion of the computation of the task, for
-getting the result of a computation or for transfering exceptions. Each __task__ has a unique identifier.
+getting the result of a computation or for transfering exceptions. __task__ supports move semantics.
 
 
 [heading Creation]
@@ -106,13 +106,23 @@
 
         void main()
         {
- boost::task::handle< long > h( // get handle associated with the task
- boost::task::async(
- boost::task::make_task( // task, to be executed asynchronously
- cooperative,
- 10),
- boost::task::new_thread() ) ); // execution-policy
- std::cout << h.get() << std::endl; // throws boost::task::task_interrupted
+ // task for calculating fibonacci number
+ boost::task::task< long > t(
+ boost::bind(
+ cooperative,
+ 10) );
+
+ // execute task in new thread
+ boost::task::handle< long > h(
+ boost::task::async(
+ boost::move( t),
+ boost::task::new_thread() ) );
+
+ // interrupt task an wait until it is removed by the worker-thread
+ h.interrupt_and_wait();
+
+ // throws boost::task::task_interrupted
+ std::cout << h.get() << std::endl;
         }
 ``
 
@@ -131,12 +141,17 @@
 
         void main()
         {
- boost::task::handle< void > h( // get handle associated with the task
- boost::task::async(
- boost::task::make_task( // task, to be executed asynchronously
- throwing),
- boost::task::new_thread() ) ); // execution-policy
- std::cout << h.wait() << std::endl; // throws std::domain_error
+ // task will throw std::domain_error
+ boost::task::task void > t( throwing);
+
+ // execute task asynchron
+ boost::task::handle< void > h(
+ boost::task::async(
+ boost::move( t),
+ boost::task::new_thread() ) );
+
+ // throws std::domain_error
+ std::cout << h.wait() << std::endl;
         }
 ``
 
@@ -182,34 +197,57 @@
                 if ( n < cutof) return serial_fib( n);
                 else
                 {
- // submit a sub-task to pool calculating fibonacci(n-1)
- h1 = boost::task::async(
- boost::task::make_task(
+ // sub-task for calculating fibonacci(n-1)
+ boost::task::task< long > t1(
+ boost::bind(
                                         parallel_fib,
                                         n - 1,
                                         cutof) );
-
- // submit a sub-task to pool calculating fibonacci(n-2)
- h2 = boost::task::async(
- boost::task::make_task(
+ // sub-task for calculating fibonacci(n-2)
+ boost::task::task< long > t2(
+ boost::bind(
                                         parallel_fib,
                                         n - 2,
                                         cutof) );
 
- // calculate fibonacci(n) from the results of both sub-tasks
+ // submit a sub-task to pool calculating fibonacci(n-1)
+ boost::task::handle< long > h1(
+ boost::task::async(
+ boost::move( t1) );
+
+ // submit a sub-task to pool calculating fibonacci(n-2)
+ boost::task::handle< long > h2(
+ boost::task::async(
+ boost::move( t2) );
+
+ // calculate fibonacci(n) by joining results of both sub-tasks
                         return h1.get() + h2.get();
                 }
         }
 
         void main()
         {
- boost::task::handle< long > h( // handle for fibonacci calculation
+ // create thread-pool
+ boost::task::static_pool<
+ boost::task::unbounded_channel<
+ boost::task::fifo
+ >
+ > pool( boost::task::poolsize( 5) );
+
+ // task calculates recursivly fibonacci-numberof 10
+ boost::task::task< long > t(
+ boost::bind(
+ parallel_fib,
+ 10,
+ 5) );
+
+ // execute task asynchron in thread-pool
+ boost::task::handle< long > h(
                         boost::task::async(
- boost::task::make_task( // calculate fibonacci number 10
- parallel_fib, // for numbers < 5 do inline recursive calculation
- 10,
- 5),
- boost::task::default_pool() ) ); // access the default thread-pool
+ boost::move( t),
+ pool) );
+
+ // get result
                 std::cout << h.get() << std::endl;
         }
 ``

Modified: sandbox/task/libs/task/doc/todo.qbk
==============================================================================
--- sandbox/task/libs/task/doc/todo.qbk (original)
+++ sandbox/task/libs/task/doc/todo.qbk 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -39,8 +39,7 @@
 
 [heading Interdepended task]
 
-* With special support of concurrence and synchronisation abstractions interdepended tasks work in __thread_pools__ (using context
-switching/fibers).
+* With special support of concurrence and synchronisation abstractions interdepended tasks work in __thread_pools__ without deadlocking the pool.
 
 
 [heading Support of explicit processor bindig]
@@ -55,11 +54,5 @@
 * maybe lock-free-queue as global queue too (how to provide the scheduling policies fifo, priority, smart?)
 
 
-[heading Actor framework]
-
-* framework support of communication and synchronisation between tasks
-* so called actors provide the required mechanisms
-* for a detailed explanation read Micorsoft proposal of [@http://msdn.microsoft.com/en-us/devlabs/dd795202.aspx Axum]
-
 
 [endsect]

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-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -39,6 +39,7 @@
                         tsk::poolsize( 3),
                         tsk::high_watermark( 10),
                         tsk::low_watermark( 5) );
+ BOOST_CHECK( pool1);
                 BOOST_CHECK_EQUAL( pool1.size(), std::size_t( 3) );
                 BOOST_CHECK_EQUAL( pool1.idle(), std::size_t( 3) );
                 BOOST_CHECK_EQUAL( pool1.active(), std::size_t( 0) );
@@ -48,6 +49,7 @@
                 tsk::static_pool<
                         tsk::bounded_channel< tsk::fifo >
> pool2;
+ BOOST_CHECK( ! pool2);
                 BOOST_CHECK_THROW( pool2.size(), tsk::pool_moved);
                 BOOST_CHECK_THROW( pool2.idle(), tsk::pool_moved);
                 BOOST_CHECK_THROW( pool2.active(), tsk::pool_moved);
@@ -55,13 +57,15 @@
                 BOOST_CHECK_THROW( pool2.lower_bound(), tsk::pool_moved);
 
                 pool2 = boost::move( pool1);
-
+
+ BOOST_CHECK( ! pool1);
                 BOOST_CHECK_THROW( pool1.size(), tsk::pool_moved);
                 BOOST_CHECK_THROW( pool1.idle(), tsk::pool_moved);
                 BOOST_CHECK_THROW( pool1.active(), tsk::pool_moved);
                 BOOST_CHECK_THROW( pool1.upper_bound(), tsk::pool_moved);
                 BOOST_CHECK_THROW( pool1.lower_bound(), tsk::pool_moved);
 
+ BOOST_CHECK( pool2);
                 BOOST_CHECK_EQUAL( pool2.size(), std::size_t( 3) );
                 BOOST_CHECK_EQUAL( pool2.idle(), std::size_t( 3) );
                 BOOST_CHECK_EQUAL( pool2.active(), std::size_t( 0) );

Modified: sandbox/task/libs/task/test/test_task.cpp
==============================================================================
--- sandbox/task/libs/task/test/test_task.cpp (original)
+++ sandbox/task/libs/task/test/test_task.cpp 2009-06-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -29,20 +29,34 @@
 class test_task
 {
 public:
- // check moved task
+ // check vaild task
         void test_case_1()
         {
                 tsk::task< int > t1(
                         boost::bind(
                                 fibonacci_fn,
                                 10) );
+ tsk::task< int > t2;
+ BOOST_CHECK( t1);
+ BOOST_CHECK( ! t2);
+ }
+
+ // check moved task
+ void test_case_2()
+ {
+ tsk::task< int > t1(
+ boost::bind(
+ fibonacci_fn,
+ 10) );
+ BOOST_CHECK( t1);
                 tsk::task< int > t2( boost::move( t1) );
+ BOOST_CHECK( ! t1);
                 BOOST_CHECK_THROW( t1(), tsk::task_moved);
                 BOOST_CHECK_NO_THROW( t2() );
         }
 
         // check execute twice
- void test_case_2()
+ void test_case_3()
         {
                 tsk::task< int > t1(
                         boost::bind(
@@ -53,7 +67,7 @@
         }
 
         // check swap
- void test_case_3()
+ void test_case_4()
         {
                 tsk::task< int > t1(
                         boost::bind(
@@ -76,6 +90,7 @@
         test->add( BOOST_CLASS_TEST_CASE( & test_task::test_case_1, instance) );
         test->add( BOOST_CLASS_TEST_CASE( & test_task::test_case_2, instance) );
         test->add( BOOST_CLASS_TEST_CASE( & test_task::test_case_3, instance) );
+ test->add( BOOST_CLASS_TEST_CASE( & test_task::test_case_4, instance) );
 
         return test;
 }

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-19 16:43:57 EDT (Fri, 19 Jun 2009)
@@ -36,6 +36,7 @@
                 tsk::static_pool<
                         tsk::unbounded_channel< tsk::fifo >
> pool1( tsk::poolsize( 3) );
+ BOOST_CHECK( pool1);
                 BOOST_CHECK_EQUAL( pool1.size(), std::size_t( 3) );
                 BOOST_CHECK_EQUAL( pool1.idle(), std::size_t( 3) );
                 BOOST_CHECK_EQUAL( pool1.active(), std::size_t( 0) );
@@ -43,16 +44,19 @@
                 tsk::static_pool<
                         tsk::unbounded_channel< tsk::fifo >
> pool2;
+ BOOST_CHECK( ! pool2);
                 BOOST_CHECK_THROW( pool2.size(), tsk::pool_moved);
                 BOOST_CHECK_THROW( pool2.idle(), tsk::pool_moved);
                 BOOST_CHECK_THROW( pool2.active(), tsk::pool_moved);
 
                 pool2 = boost::move( pool1);
-
+
+ BOOST_CHECK( ! pool1);
                 BOOST_CHECK_THROW( pool1.size(), tsk::pool_moved);
                 BOOST_CHECK_THROW( pool1.idle(), tsk::pool_moved);
                 BOOST_CHECK_THROW( pool1.active(), tsk::pool_moved);
 
+ BOOST_CHECK( pool2);
                 BOOST_CHECK_EQUAL( pool2.size(), std::size_t( 3) );
                 BOOST_CHECK_EQUAL( pool2.idle(), std::size_t( 3) );
                 BOOST_CHECK_EQUAL( pool2.active(), std::size_t( 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