|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r54215 - in sandbox/task: boost/task libs/task/doc libs/task/test
From: oliver.kowalke_at_[hidden]
Date: 2009-06-22 15:37:53
Author: olli
Date: 2009-06-22 15:37:49 EDT (Mon, 22 Jun 2009)
New Revision: 54215
URL: http://svn.boost.org/trac/boost/changeset/54215
Log:
* default sorting order for priority-scheduling is std::greater<>
* corrected tests
* documentation updated
Text files modified:
sandbox/task/boost/task/priority.hpp | 2
sandbox/task/libs/task/doc/acknowledgements.qbk | 2
sandbox/task/libs/task/doc/as_sub_task.qbk | 6 +--
sandbox/task/libs/task/doc/async.qbk | 18 ++++++-----
sandbox/task/libs/task/doc/boost_task.qbk | 3 +
sandbox/task/libs/task/doc/fork_join.qbk | 23 ++++++-------
sandbox/task/libs/task/doc/handle.qbk | 51 ++++++++++++++-----------------
sandbox/task/libs/task/doc/introduction.qbk | 63 +++++++++++++++++----------------------
sandbox/task/libs/task/doc/new_thread.qbk | 13 +++-----
sandbox/task/libs/task/doc/overview.qbk | 31 ++++++++++--------
sandbox/task/libs/task/doc/own_thread.qbk | 5 --
sandbox/task/libs/task/doc/pool.qbk | 5 --
sandbox/task/libs/task/doc/processor_binding.qbk | 2
sandbox/task/libs/task/doc/ref_exceptions.qbk | 46 ++++++++++++++--------------
sandbox/task/libs/task/doc/ref_handle.qbk | 24 +-------------
sandbox/task/libs/task/doc/ref_meta.qbk | 10 ++++++
sandbox/task/libs/task/doc/ref_static_pool.qbk | 23 ++++++++++++++
sandbox/task/libs/task/doc/ref_task.qbk | 44 ++++++++++++++++++++------
sandbox/task/libs/task/doc/ref_utility.qbk | 14 ++++----
sandbox/task/libs/task/doc/reference.qbk | 2
sandbox/task/libs/task/doc/scheduler.qbk | 4 +-
sandbox/task/libs/task/doc/shutdown.qbk | 12 ++-----
sandbox/task/libs/task/doc/task.qbk | 59 ++++++++++++++++--------------------
sandbox/task/libs/task/doc/todo.qbk | 5 ---
sandbox/task/libs/task/doc/work_stealing.qbk | 1
sandbox/task/libs/task/test/test_bounded_pool.cpp | 4 +-
sandbox/task/libs/task/test/test_unbounded_pool.cpp | 4 +-
27 files changed, 237 insertions(+), 239 deletions(-)
Modified: sandbox/task/boost/task/priority.hpp
==============================================================================
--- sandbox/task/boost/task/priority.hpp (original)
+++ sandbox/task/boost/task/priority.hpp 2009-06-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -24,7 +24,7 @@
{
template<
typename Attr,
- typename Ord = std::less< Attr >
+ typename Ord = std::greater< Attr >
>
struct priority
{
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-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -8,7 +8,7 @@
[section:acknowledgements Appendix B: Acknowledgments]
-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.
+I'd like to thank Vicente J. Botet Escriba for his contributions (this_task::reschedule_until, this_task::delay, this_task::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-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -13,10 +13,8 @@
``
- boost::task::task< long > t(
- boost::bind(
- fibonacci,
- 10) );
+ boost::task::task< long > t( fibonacci, 10);
+
boost::task::handle< long > h(
boost::task::async(
boost::move( t),
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-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -9,7 +9,7 @@
[section:async Asynchronous execution]
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)`).
+required to provide `handle< R > operator()( task< R > && t)`).
__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,14 +31,16 @@
void main()
{
- 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
+ // task -> compute fibonacci(10)
+ boost::task< long > t( fibonacci, 10);
+
+ // move the task to executor
+ boost::task::handle< long > h(
+ boost::task::async(
boost::move( t) );
- std::cout << "fibonacci(10) == " << h.get() << std::endl; // access the result
+
+ // access the result
+ std::cout << "fibonacci(10) == " << h.get() << std::endl;
}
``
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-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -33,6 +33,7 @@
[template link_task[link_text] [link boost_task.task [link_text]]]
[template link_work_stealing[link_text] [link boost_task.pool.work_stealing [link_text]]]
+[def __shared_future__ `boost::shared_future`]
[def __thread__ `boost::thread`]
[def __thread_id__ `boost::thread::id`]
@@ -90,7 +91,7 @@
[def __fn_interruption_requested__ `interruption_requested()`]
[def __fn_is_ready__ `is_ready()`]
[def __fn_operator__ `operator()()`]
-[def __fn_pending__ `pending()()`]
+[def __fn_pending__ `pending()`]
[def __fn_size__ `size()`]
[def __fn_shutdown__ `shutdown()`]
[def __fn_shutdown_now__ `shutdown_now()`]
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-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -28,16 +28,14 @@
{
// fork a sub-task calculating fibonacci(n-1)
boost::task::task< long > t1(
- boost::bind(
- parallel_fib,
- n - 1,
- cutof) );
+ parallel_fib,
+ n - 1,
+ cutof);
// fork a sub-task calculating fibonacci(n-2)
boost::task< long > t2(
- boost::bind(
- parallel_fib,
- n - 2,
- cutof) );
+ parallel_fib,
+ n - 2,
+ cutof);
h1 = boost::task::async( boost::move( t1) );
h2 = boost::task::async( boost::move( t2) );
@@ -58,11 +56,12 @@
>
> pool( boost::task::poolsize( 5) );
+ // calculate fibonacci number 10
+ // for numbers < 5 do inline serial calculation
boost::task::task< long > t(
- boost::bind( // calculate fibonacci number 10
- parallel_fib, // for numbers < 5 do inline recursive calculation
- 10,
- 5) );
+ parallel_fib,
+ 10,
+ 5);
boost::task::handle< long > h( // handle for fibonacci calculation
boost::task::async(
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-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -50,20 +50,24 @@
void main()
{
- boost::task::task< long > t(
- boost::bind(
- fibonacci,
- 10) );
+ // create task
+ boost::task::task< long > t( fibonacci, 10);
+ // move task ownership to executor
boost::task::handle< long > h(
boost::task::async(
boost::move( t),
boost::task::new_thread() ) );
std::cout << "is ready == " << std::boolalpha << h.is_ready() << "\n";
+
+ // wait for task completion
h.wait();
+
std::cout << "has value == " << std::boolalpha << h.has_value() << "\n";
std::cout << "has exception == " << std::boolalpha << h.has_exception() << "\n";
+
+ // return result
std::cout << "fibonacci(10) == " << h.get() << std::endl;
}
``
@@ -110,26 +114,29 @@
void main()
{
- boost::task::task< long > t(
- boost::bind( // task, to be executed asynchronously
- cooperative,
- 10) );
+ // task, to be executed asynchronously
+ boost::task::task< long > t( cooperative, 10);
- boost::task::handle< long > h( // get handle associated with the task
+ // move task to async. executor
+ boost::task::handle< long > h(
boost::task::async(
boost::move( t),
- boost::task::new_thread() ) ); // asynchronous executor
+ boost::task::new_thread() ) );
+ // interrupt task and wait until task is removed by worker-thread
h.interrupt_and_wait();
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";
- std::cout << h.get() << std::endl; // throws boost::task::task_interrupted
+
+ // access result
+ // throws boost::task::task_interrupted
+ std::cout << h.get() << std::endl;
}
``
-[note If the task is still pending when an interruption is requested - the task is not removed from the queue, it is marked to be interrupted instead.]
+[note If the task is still pending (not executed yet) when an interruption is requested - the task is not removed from the queue, it is marked to be interrupted instead.]
[heading Waiting for handles]
@@ -145,10 +152,7 @@
for ( int i = 0; i < 10; ++i)
{
- boost::task::task< long > t(
- boost::bind(
- fibonacci,
- 10) );
+ boost::task::task< long > t( fibonacci, i);
results.push_back(
boost::task::async(
@@ -175,18 +179,9 @@
``
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::task< long > t1( cooperative, 10);
+ boost::task::task< long > t2( cooperative, 7);
+ boost::task::task< long > t3( cooperative, 5);
boost::task::handle< long > h1(
boost::task::async(
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-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -32,13 +32,11 @@
void main()
{
- boost::task::task< void > t( // task, to be executed asynchronously
- boost::bind(
- print,
- "Hello World!") );
+ // task, to be executed asynchronously
+ boost::task::task< void > t( print, "Hello World!");
boost::task::async( // dispatchs task,
- boost::move( t), // move task to executor
+ boost::move( t), // move task ownership to executor
boost::task::new_thread() ) ); // execution-policy
}
``
@@ -52,14 +50,12 @@
void main()
{
- boost::task::task< std::string > t( // task returning the submitted string
- boost::bind(
- echo,
- "Hello World!") );
+ // task returning the submitted string
+ boost::task::task< std::string > t( echo, "Hello World!");
boost::task::handle< std::string > h(
boost::task::async(
- boost::move( t), // move task to executor
+ boost::move( t), // move task ownership 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
@@ -74,15 +70,13 @@
void main()
{
- boost::task::task< void > t( // long runing task
- boost::bind(
- long_running,
- boost::posix_time::millisec( 500) ) );
+ // long runing task
+ boost::task::task< void > t( long_running, boost::posix_time::millisec( 500) );
boost::task::handle< std::string > h(
boost::task::async(
- boost::move( t),
- boost::task::new_thread() ) );
+ boost::move( t), // move task ownership to executor
+ boost::task::new_thread() ) ); // execute task in a new thread
h.interrupt(); // interrupt execution of task
@@ -107,16 +101,14 @@
{
// fork a sub-task calculating fibonacci(n-1)
boost::task::task< long > t1(
- boost::bind(
- parallel_fib,
- n - 1,
- cutof) );
+ parallel_fib,
+ n - 1,
+ cutof);
// fork a sub-task calculating fibonacci(n-2)
boost::task::task< long > t2(
- boost::bind(
- parallel_fib,
- n - 2,
- cutof) );
+ parallel_fib,
+ n - 2,
+ cutof);
boost::task::handle< long > h1(
boost::task::async(
@@ -140,16 +132,16 @@
>
> pool( boost::task::poolsize( 5) );
- boost::task::task< long > t( // task calculates fibonacci-number for 10
- boost::bind(
- parallel_fib,
- 10,
- 5) );
+ // task calculates fibonacci-number for 10
+ boost::task::task< long > t(
+ parallel_fib,
+ 10,
+ 5);
- boost::task::handle< long > h( // handle of async. executed task
+ boost::task::handle< long > h(
boost::task::async(
- boost::move( t),
- boost::task::default_pool() ) ); // thread-pool
+ boost::move( t), // move task ownership to thread-pool
+ boost::task::default_pool() ) ); // execution-policy == thread-pool
std::cout << h.get() << std::endl;
}
@@ -162,10 +154,9 @@
``
boost::task::task< long > t(
- boost::bind(
- parallel_fib,
- 10,
- 5) );
+ parallel_fib,
+ 10,
+ 5);
boost::task::async(
boost::move( t),
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-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -10,8 +10,8 @@
__new_thread__ creates a new __thread__ and executes the task in this thread (asynchronous). The created thread gets joined by
handle (so [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2802.html N2802] should be addressed).
-The returned __handle__ joins the thread in its destructor (if the last reference gets out of scope) and thus provides one possible
-solution of [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2880.html N2880].
+The returned __handle__ joins the thread in its destructor (if the last reference gets out of scope) [/and thus provides one possible
+solution of [@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2880.html N2880]].
@@ -32,10 +32,7 @@
void main()
{
- boost::task::task< long > t(
- boost::bind(
- fibonacci,
- 10) );
+ boost::task::task< long > t( fibonacci, 10);
boost::task::handle< long > h(
boost::task::async(
@@ -50,8 +47,8 @@
reference gets out of scope). ]
-In the example below both `a_function()` and `another_function()` are executed synchron (see [link_own_thread __own_thread__]
-for synchronous execution)!
+In the example below both `a_function()` and `another_function()` are executed synchron because the returned __handle__ joins the
+the __worker_thread__!
``
boost::task::task< void > t1( a_function);
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-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -14,21 +14,21 @@
* __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:
+* __handle__, works as a __act__ of executed task:
* __fn_interrupt__, __fn_interrupt_and_wait__, ... allow to cancel an cooperative task
- * interface of __act__:
+ * interface of the __act__:
* __fn_get__ retrieve value or exception of task execution
* __fn_is_ready__ test if task was executed
* __fn_wait__, __fn_wait_for__ and __fn_wait_until__ block until task is executed and the result is set
- * __fn_get_future__ returns reference to internal future
+ * __fn_get_future__ returns reference to internal __shared_future__
* functions __waitfor_all__/__waitfor_any__ to wait for all or any handles
-* __fn_async__, executes a task on behalf of __eps__ asynchronously
+* __fn_async__, executes a task on behalf of __eps__
* __ep__ models:
* __own_thread__: executes task in current thread.
* __new_thread__: executes task in a newly created thread (thread will be destroyed after)
- * __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
+ * __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 __thread_pool__
* __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 and for/join semantics
@@ -75,15 +75,11 @@
void main()
{
- boost::task< long > t1(
- boost::bind(
- fibonacci,
- 10) );
- boost::task< long > t2(
- boost::bind(
- fibonacci,
- 5) );
+ // create two tasks for calculating fibonacci numbers
+ boost::task< long > t1( fibonacci, 10);
+ boost::task< long > t2( fibonacci, 5);
+ // move tasks ownership to executor
boost::task::handle< long > h1(
boost::task::async(
boost::move( t1), tsk::new_thread() );
@@ -93,13 +89,18 @@
std::cout << "h1: is ready == " << std::boolalpha << h1.is_ready() << "\n";
std::cout << "h2: is ready == " << std::boolalpha << h2.is_ready() << "\n";
+
+ // wait for completion of both tasks
boost::task::waitfor_all( h1, h2);
+
std::cout << "h1: is ready == " << std::boolalpha << h1.is_ready() << "\n";
std::cout << "h2: is ready == " << std::boolalpha << h2.is_ready() << "\n";
std::cout << "h1: has value == " << std::boolalpha << h1.has_value() << "\n";
std::cout << "h2: has value == " << std::boolalpha << h2.has_value() << "\n";
std::cout << "h1: has exception == " << std::boolalpha << h1.has_exception() << "\n";
std::cout << "h2: has exception == " << std::boolalpha << h2.has_exception() << "\n";
+
+ // get results
std::cout << "fibonacci(10) == " << h1.get() << std::endl;
std::cout << "fibonacci(5) == " << h2.get() << std::endl;
}
@@ -122,6 +123,8 @@
[note __boost_task__ uses __boost_future__ from Anthony Williams (will be integrated in some of the next releases of __boost_thread__).]
+[note Please note that __boost_task__ is not optimized yet.]
+
[heading Tested Platforms]
@@ -139,7 +142,7 @@
* 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
-* call `bjam toolset=<compiler-name> --with-task install` in order to install __boost_task__
+* call [''bjam toolset=<compiler-name> --with-task install'] in order to build and 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-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -27,10 +27,7 @@
void main()
{
- boost::task::task< long > t(
- boost::bind(
- fibonacci,
- 10) );
+ boost::task::task< long > t( fibonacci, 10);
boost::task::handle< long > h(
boost::task::async(
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-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -29,10 +29,7 @@
>
> pool( boost::task::poolsize( 5) );
- boost::task::task< std::string > t(
- boost::bind(
- echo,
- "Hello World!") );
+ boost::task::task< std::string > t( echo, "Hello World!");
boost::task::handle< std::string > h(
boost::task::async(
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-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -20,7 +20,7 @@
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.
+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, Solaris and FreeBSD.]
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-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -23,8 +23,8 @@
invalid_poolsize( std::string const& msg);
[variablelist
-[[Effects:] [Constructs a `boost::task::invalid_poolsize` instance.]]
-[[Throws:] [Nothing]]
+[[Effects:] [constructs a `boost::task::invalid_poolsize` instance]]
+[[Throws:] [nothing]]
]
[endsect]
@@ -42,13 +42,13 @@
};
``
-heading Constructor]
+[heading Constructor]
invalid_scanns( std::string const& msg)
[variablelist
-[[Effects:] [Constructs a `boost::task::invalid_scanns` instance.]]
-[[Throws:] [Nothing]]
+[[Effects:] [constructs a `boost::task::invalid_scanns` instance]]
+[[Throws:] [nothing]]
]
[endsect]
@@ -71,8 +71,8 @@
invalid_timeduration( std::string const& msg)
[variablelist
-[[Effects:] [Constructs a `boost::task::invalid_timeduration` instance.]]
-[[Throws:] [Nothing]]
+[[Effects:] [constructs a `boost::task::invalid_timeduration` instance]]
+[[Throws:] [nothing]]
]
[endsect]
@@ -95,8 +95,8 @@
invalid_watermark( std::string const& msg)
[variablelist
-[[Effects:] [Constructs a `boost::task::invalid_watermark` instance.]]
-[[Throws:] [Nothing]]
+[[Effects:] [constructs a `boost::task::invalid_watermark` instance]]
+[[Throws:] [nothing]]
]
[endsect]
@@ -119,8 +119,8 @@
task_rejected( std::string const& msg)
[variablelist
-[[Effects:] [Constructs a `boost::task::task_rejected` instance.]]
-[[Throws:] [Nothing]]
+[[Effects:] [constructs a `boost::task::task_rejected` instance]]
+[[Throws:] [nothing]]
]
[endsect]
@@ -143,8 +143,8 @@
task_unitialized()
[variablelist
-[[Effects:] [Constructs a `boost::task::task_unitialized` instance.]]
-[[Throws:] [Nothing]]
+[[Effects:] [constructs a `boost::task::task_unitialized` instance]]
+[[Throws:] [nothing]]
]
[endsect]
@@ -167,8 +167,8 @@
task_already_executed()
[variablelist
-[[Effects:] [Constructs a `boost::task::task_already_executed` instance.]]
-[[Throws:] [Nothing]]
+[[Effects:] [constructs a `boost::task::task_already_executed` instance]]
+[[Throws:] [nothing]]
]
[endsect]
@@ -191,8 +191,8 @@
task_moved()
[variablelist
-[[Effects:] [Constructs a `boost::task::task_moved` instance.]]
-[[Throws:] [Nothing]]
+[[Effects:] [constructs a `boost::task::task_moved` instance]]
+[[Throws:] [nothing]]
]
[endsect]
@@ -215,8 +215,8 @@
broken_task()
[variablelist
-[[Effects:] [Constructs a `boost::task::broken_task` instance.]]
-[[Throws:] [Nothing]]
+[[Effects:] [constructs a `boost::task::broken_task` instance]]
+[[Throws:] [nothing]]
]
[endsect]
@@ -239,8 +239,8 @@
task_interrupted()
[variablelist
-[[Effects:] [Constructs a `boost::task::task_interrupted` instance.]]
-[[Throws:] [Nothing]]
+[[Effects:] [constructs a `boost::task::task_interrupted` instance]]
+[[Throws:] [nothing]]
]
[endsect]
@@ -263,8 +263,8 @@
pool_moved()
[variablelist
-[[Effects:] [Constructs a `boost::task::pool_moved` instance.]]
-[[Throws:] [Nothing]]
+[[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-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -16,24 +16,16 @@
handle();
void interrupt();
-
void interrupt_and_wait();
-
void interrupt_and_wait_until( system_time const& abs_time);
-
template< typename Duration >
void interrupt_and_wait_for( Duration const& rel_time);
-
bool interruption_requested();
R get();
-
bool is_ready() const;
-
bool has_value() const;
-
bool has_exception() const;
-
void wait() const;
shared_future< R > & get_future();
@@ -46,13 +38,7 @@
template< typename T1, typename T2 >
friend void waitfor_all( T1 & t1, T2 & t2);
-
- template< typename T1, typename T2, typename T3 >
- friend void waitfor_all( handle< T1 > & t1, handle< T2 > & t2, handle< T3 > & t3);
-
- template< typename T1, typename T2, typename T3, typename T4 >
- friend void waitfor_all( handle< T1 > & t1, handle< T2 > & t2, handle< T3 > & t3, handle< T4 > & t4);
-
+ ...
template< typename T1, typename T2, typename T3, typename T4, typename T5 >
friend void waitfor_all( handle< T1 > & t1, handle< T2 > & t2, handle< T3 > & t3, handle< T4 > & t4, handle< T5 > & t5);
@@ -61,13 +47,7 @@
template< typename T1, typename T2 >
friend unsigned int waitfor_any( handle< T1 > & t1, handle< T2 > & t2);
-
- template< typename T1, typename T2, typename T3 >
- friend unsigned int waitfor_any( handle< T1 > & t1, handle< T2 > & t2, handle< T3 > & t3);
-
- template< typename T1, typename T2, typename T3, typename T4 >
- friend unsigned int waitfor_any( handle< T1 > & t1, handle< T2 > & t2, handle< T3 > & t3, handle< T4 > & t4);
-
+ ...
template< typename T1, typename T2, typename T3, typename T4, typename T5 >
friend unsigned int waitfor_any( handle< T1 > & t1, handle< T2 > & t2, handle< T3 > & t3, handle< T4 > & t4, handle< T5 > & t5);
``
Modified: sandbox/task/libs/task/doc/ref_meta.qbk
==============================================================================
--- sandbox/task/libs/task/doc/ref_meta.qbk (original)
+++ sandbox/task/libs/task/doc/ref_meta.qbk 2009-06-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -21,6 +21,11 @@
{};
``
+[variablelist
+[[Effects:] [returns true if Pool supports attributes (priority-scheduling)]]
+[[Throws:] [nothing]]
+]
+
[endsect]
@@ -36,4 +41,9 @@
};
``
+[variablelist
+[[Effects:] [returns type of attribute]]
+[[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-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -77,6 +77,9 @@
handle< R > submit( task< R > && t, Attr const& attr);
void swap( static_pool & other); // throw()
+
+ operator unspecified_bool_type() const;
+ bool operator!() const;
};
``
@@ -379,4 +382,24 @@
]
+[heading operator `operator unspecified_bool_type()`]
+
+ operator unspecified_bool_type() const
+
+[variablelist
+[[Effects:] [is static_pool valid == does static_pool own ownership]]
+[[Throws:] [Nothing]]
+]
+
+
+[heading operator `operator!()`]
+
+ bool operator!() const
+
+[variablelist
+[[Effects:] [is static_pool invalid == static_pool does not have ownership]]
+[[Throws:] [Nothing]]
+]
+
+
[endsect]
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-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -21,9 +21,14 @@
template< typename Fn >
task( Fn fn);
+ template< typename Fn, typename A0 >
+ task( Fn fn, A0 a0);
+ ...
+ template< typename Fn, typename A0, ..., typename A9 >
+ task( Fn fn, A0 a0, ..., A9 a9);
+
task( task && t);
task & operator=( task && t);
-
task && move();
shared_future< R > & get_future();
@@ -33,7 +38,10 @@
template< typename Cb >
void set_wait_callback( Cb const& cb);
- void swap( task< R > & other); // throw()
+ void swap( task< R > & other);
+
+ operator unspecified_bool_type() const;
+ bool operator!() const;
};
``
@@ -47,7 +55,17 @@
]
-[heading Constructor]
+[heading Constructor (function pointer)]
+
+ task( R( * fn)());
+
+[variablelist
+[[Effects:] [constructs a `boost::task::task< R >` from a function pointer]]
+[[Throws:] [Nothing]]
+]
+
+
+[heading Constructor (functor)]
template< typename Fn >
task( Fn const& fn)
@@ -58,12 +76,16 @@
]
-[heading Constructor]
+[heading Constructor (functor with arguments)]
- task( R( * fn)());
+ template< typename Fn, typename A0 >
+ task( Fn fn, A0 a0);
+ ...
+ template< typename Fn, typename A0, ..., typename A9 >
+ task( Fn fn, A0 a0, ..., A9 a9);
[variablelist
-[[Effects:] [constructs a `boost::task::task< R >` from a function pointer]]
+[[Effects:] [constructs a `boost::task::task< R >` from a function object and its arguments]]
[[Throws:] [Nothing]]
]
@@ -78,7 +100,7 @@
]
-[heading Move-assignment constructor]
+[heading Move-assignment operator]
task & operator=( task &&)
@@ -113,7 +135,7 @@
void operator()()
[variablelist
-[[Effects:] [executes tasks internal function object]]
+[[Effects:] [executes task's internal function object]]
[[Throws:] [Nothing]]
]
@@ -141,7 +163,7 @@
[heading operator `operator unspecified_bool_type()`]
- operator unspecified_bool_type() const // throw()
+ operator unspecified_bool_type() const
[variablelist
[[Effects:] [is task valid == does task own ownership]]
@@ -151,10 +173,10 @@
[heading operator `operator!()`]
- bool operator!() const // throw()
+ bool operator!() const
[variablelist
-[[Effects:] [is task invalid == does task not own ownership]]
+[[Effects:] [is task invalid == task does not have ownership]]
[[Throws:] [Nothing]]
]
Modified: sandbox/task/libs/task/doc/ref_utility.qbk
==============================================================================
--- sandbox/task/libs/task/doc/ref_utility.qbk (original)
+++ sandbox/task/libs/task/doc/ref_utility.qbk 2009-06-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -16,7 +16,7 @@
``
[variablelist
-[[Effects:] [reschedules current task until passed callable predicate becomes ready]
+[[Effects:] [reschedules current task until passed callable predicate becomes ready]]
[[Throws:] [`boost::thread_interrupted`,`boost::system::system_error`]]
[[Note:] [this function resides in namespace `boost::this_task`]]
]
@@ -34,7 +34,7 @@
``
[variablelist
-[[Effects:] [returns reference to the thread-pool where the current worker thread is executed]
+[[Effects:] [returns reference to the thread-pool where the current worker thread is executed]]
[[Throws:] [nothing]]
[[Note:] [this function resides in namespace `boost::this_task`]]
]
@@ -51,7 +51,7 @@
``
[variablelist
-[[Effects:] [returns true if the current task is executed in a thread-pool]
+[[Effects:] [returns true if the current task is executed in a thread-pool]]
[[Throws:] [nothing]]
[[Note:] [this function resides in namespace `boost::this_task`]]
]
@@ -68,7 +68,7 @@
``
[variablelist
-[[Effects:] [returns returns the thread-id of the worker-thread]
+[[Effects:] [returns returns the thread-id of the worker-thread]]
[[Throws:] [nothing]]
[[Note:] [this function resides in namespace `boost::this_task`]]
]
@@ -88,7 +88,7 @@
``
[variablelist
-[[Effects:] [delays the execution of the current task so that the worker-thread can process another task in the meantime]
+[[Effects:] [delays the execution of the current task so that the worker-thread can process another task in the meantime]]
[[Throws:] [nothing]]
[[Note:] [this function resides in namespace `boost::this_task`]]
]
@@ -105,7 +105,7 @@
``
[variablelist
-[[Effects:] [yields the current task so that the worker-threadcan process another task in the meantime]
+[[Effects:] [yields the current task so that the worker-threadcan process another task in the meantime]]
[[Throws:] [nothing]]
[[Note:] [this function resides in namespace `boost::this_task`]]
]
@@ -122,7 +122,7 @@
``
[variablelist
-[[Effects:] [task can request interruption for itself]
+[[Effects:] [task can request interruption for itself]]
[[Throws:] [nothing]]
[[Note:] [this function resides in namespace `boost::this_task`]]
]
Modified: sandbox/task/libs/task/doc/reference.qbk
==============================================================================
--- sandbox/task/libs/task/doc/reference.qbk (original)
+++ sandbox/task/libs/task/doc/reference.qbk 2009-06-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -16,10 +16,10 @@
[include ref_static_pool.qbk]
[include ref_utility.qbk]
[include ref_meta.qbk]
-[include ref_exceptions.qbk]
[include ref_poolsize.qbk]
[include ref_watermark.qbk]
[include ref_scanns.qbk]
+[include ref_exceptions.qbk]
[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-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -41,12 +41,12 @@
In this example the tasks get scheduled by the assigned integer (third argument of __fn_async__). The __task__ with the
lowest priority gets scheduled first (taken by a __worker_thread__). The ordering can be changed by the second argument
-of __priority__ (the default is `std::less< Attr >`).
+of __priority__ (the default is `std::greater< Attr >`).
``
boost::task::static_pool<
boost::task::unbounded_channel<
- boost::task::priority< int, std::greater< int > > > // tasks with higher priority are scheduled first
+ boost::task::priority< int > > // tasks with higher priority are scheduled first
> pool( boost::task::poolsize( 5) );
``
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-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -45,10 +45,8 @@
...
- boost::task::task< long > t1(
- boost::bind( fibonacci_fn, 10) );
- boost::task::task< long > t2(
- boost::bind( fibonacci_fn, 5) );
+ boost::task::task< long > t1( fibonacci_fn, 10);
+ boost::task::task< long > t2( fibonacci_fn, 5);
boost::task::handle< long > h1(
boost::task::async(
@@ -101,10 +99,8 @@
...
- boost::task::task< long > t1(
- boost::bind( fibonacci_fn, 10) );
- boost::task::task< long > t2(
- boost::bind( fibonacci_fn, 5) );
+ boost::task::task< long > t1( fibonacci_fn, 10);
+ boost::task::task< long > t2( fibonacci_fn, 5);
boost::task::handle< long > h1(
boost::task::async(
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-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -12,22 +12,17 @@
__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. __task__ supports move semantics.
-
+getting the result of a computation or for transfering exceptions. __task__ supports move semantics (moving ownership).
+[/
[heading Creation]
-__fn_make_task__ can be used to create __task__ by passing free-functions or member-functions of objects and its arguments:
-__fn_make_task__ accepts up to ten arguments per default (can be overriden by defining BOOST_TASK_MAKE_TASK_MAX_ARITY with
-the new value).
+__tasks__ are created by passing free-functions or member-functions of objects and its arguments to the task-constructor.
* create task from free-function with arguments:
``
- boost::task::task< int > t(
- boost::task::make_task(
- parallel_fib,
- 10) );
+ boost::task::task< int > t( parallel_fib, 10);
``
* create task from member-function with arguments:
@@ -40,10 +35,9 @@
X x;
boost::task::task< int > t(
- boost::task::make_task(
- & X::f,
- x,
- 10) );
+ & X::f,
+ x,
+ 10);
``
It is possible to create __task__ from a __callable__ too:
@@ -57,7 +51,7 @@
Y y;
boost::task::task< std::string > t( y);
``
-
+]
[heading Cooperative task and interruption]
@@ -107,10 +101,7 @@
void main()
{
// task for calculating fibonacci number
- boost::task::task< long > t(
- boost::bind(
- cooperative,
- 10) );
+ boost::task::task< long > t( cooperative, 10) );
// execute task in new thread
boost::task::handle< long > h(
@@ -171,13 +162,19 @@
* `std::range_error`
* `std::runtime_error`
* `std::underflow_error`
+* `boost::exception`
* `boost::future_already_set`
* `boost::future_cancel`
-* `boost::exception`
* `boost::invalid_thread_argument`
* `boost::lock_error`
-* `boost::task::task_interrupted`
* `boost::broken_task`
+* `boost::pool_moved`
+* `boost::task_already_executed`
+* `boost::task_interrupted`
+* `boost::task_moved`
+* `boost::task::task_interrupted`
+* `boost::task_task_rejected`
+* `boost::task_unitialized`
[heading Parent task]
@@ -199,22 +196,19 @@
{
// sub-task for calculating fibonacci(n-1)
boost::task::task< long > t1(
- boost::bind(
- parallel_fib,
- n - 1,
- cutof) );
+ parallel_fib,
+ n - 1,
+ cutof);
// sub-task for calculating fibonacci(n-2)
boost::task::task< long > t2(
- boost::bind(
- parallel_fib,
- n - 2,
- cutof) );
+ parallel_fib,
+ n - 2,
+ cutof);
// 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(
@@ -236,10 +230,9 @@
// task calculates recursivly fibonacci-numberof 10
boost::task::task< long > t(
- boost::bind(
- parallel_fib,
- 10,
- 5) );
+ parallel_fib,
+ 10,
+ 5);
// execute task asynchron in thread-pool
boost::task::handle< long > h(
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-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -42,11 +42,6 @@
* With special support of concurrence and synchronisation abstractions interdepended tasks work in __thread_pools__ without deadlocking the pool.
-[heading Support of explicit processor bindig]
-
-* __eps__ related to a __thread_pool__ (like __default_pool__) could support explicit processor binding.
-
-
[heading Optimizations]
* two-lock-queue as global queue in __thread_pool__
Modified: sandbox/task/libs/task/doc/work_stealing.qbk
==============================================================================
--- sandbox/task/libs/task/doc/work_stealing.qbk (original)
+++ sandbox/task/libs/task/doc/work_stealing.qbk 2009-06-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -49,4 +49,3 @@
[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-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -556,8 +556,8 @@
tsk::async( boost::move( t3), 0, pool);
b.wait();
pool.shutdown();
- BOOST_CHECK_EQUAL( buffer[0], 0);
- BOOST_CHECK_EQUAL( buffer[1], 55);
+ BOOST_CHECK_EQUAL( buffer[0], 55);
+ BOOST_CHECK_EQUAL( buffer[1], 0);
BOOST_CHECK_EQUAL( buffer.size(), std::size_t( 2) );
}
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-22 15:37:49 EDT (Mon, 22 Jun 2009)
@@ -476,8 +476,8 @@
tsk::async( boost::move( t3), 0, pool);
b.wait();
pool.shutdown();
- BOOST_CHECK_EQUAL( buffer[0], 0);
- BOOST_CHECK_EQUAL( buffer[1], 55);
+ BOOST_CHECK_EQUAL( buffer[0], 55);
+ BOOST_CHECK_EQUAL( buffer[1], 0);
BOOST_CHECK_EQUAL( buffer.size(), std::size_t( 2) );
}
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