|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r51542 - in sandbox/threadpool: boost boost/tp boost/tp/detail libs/tp/doc libs/tp/doc/html libs/tp/doc/html/boost_threadpool libs/tp/examples libs/tp/test
From: oliver.kowalke_at_[hidden]
Date: 2009-03-02 15:16:02
Author: olli
Date: 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
New Revision: 51542
URL: http://svn.boost.org/trac/boost/changeset/51542
Log:
* taks let access internal future object
* documentation changed
* tests changed
Added:
sandbox/threadpool/libs/tp/examples/reschedule_until.cpp (contents, props changed)
Removed:
sandbox/threadpool/libs/tp/doc/wait_ref.qbk
Text files modified:
sandbox/threadpool/boost/future.hpp | 8
sandbox/threadpool/boost/tp/detail/callable.hpp | 6
sandbox/threadpool/boost/tp/detail/interrupter.hpp | 18 +-
sandbox/threadpool/boost/tp/pool.hpp | 49 +++-
sandbox/threadpool/boost/tp/task.hpp | 243 ++--------------------------
sandbox/threadpool/libs/tp/doc/forkjoin.qbk | 4
sandbox/threadpool/libs/tp/doc/html/boost_threadpool/channel.html | 4
sandbox/threadpool/libs/tp/doc/html/boost_threadpool/forkjoin.html | 37 ++--
sandbox/threadpool/libs/tp/doc/html/boost_threadpool/pool.html | 10
sandbox/threadpool/libs/tp/doc/html/boost_threadpool/reference.html | 246 +---------------------------
sandbox/threadpool/libs/tp/doc/html/boost_threadpool/scheduling.html | 8
sandbox/threadpool/libs/tp/doc/html/boost_threadpool/task.html | 22 -
sandbox/threadpool/libs/tp/doc/html/boost_threadpool/this_task.html | 13
sandbox/threadpool/libs/tp/doc/html/index.html | 11
sandbox/threadpool/libs/tp/doc/introduction.qbk | 3
sandbox/threadpool/libs/tp/doc/pool.qbk | 5
sandbox/threadpool/libs/tp/doc/reference.qbk | 1
sandbox/threadpool/libs/tp/doc/task.qbk | 12
sandbox/threadpool/libs/tp/doc/task_ref.qbk | 88 ---------
sandbox/threadpool/libs/tp/doc/this_task.qbk | 2
sandbox/threadpool/libs/tp/doc/this_task_ref.qbk | 5
sandbox/threadpool/libs/tp/doc/threadpool.xml | 334 ++++++---------------------------------
sandbox/threadpool/libs/tp/examples/fork_join.cpp | 4
sandbox/threadpool/libs/tp/examples/interrupt.cpp | 2
sandbox/threadpool/libs/tp/examples/pending.cpp | 2
sandbox/threadpool/libs/tp/examples/shutdonw_now.cpp | 2
sandbox/threadpool/libs/tp/examples/spread_over_hardware.cpp | 4
sandbox/threadpool/libs/tp/examples/submit.cpp | 2
sandbox/threadpool/libs/tp/test/test_bounded_queue_fifo.cpp | 16
sandbox/threadpool/libs/tp/test/test_bounded_queue_lifo.cpp | 43 ++--
sandbox/threadpool/libs/tp/test/test_bounded_queue_priority.cpp | 45 ++--
sandbox/threadpool/libs/tp/test/test_bounded_queue_smart.cpp | 45 ++--
sandbox/threadpool/libs/tp/test/test_unbounded_queue_fifo.cpp | 43 ++--
sandbox/threadpool/libs/tp/test/test_unbounded_queue_lifo.cpp | 43 ++--
sandbox/threadpool/libs/tp/test/test_unbounded_queue_priority.cpp | 45 ++--
sandbox/threadpool/libs/tp/test/test_unbounded_queue_smart.cpp | 45 ++--
36 files changed, 367 insertions(+), 1103 deletions(-)
Modified: sandbox/threadpool/boost/future.hpp
==============================================================================
--- sandbox/threadpool/boost/future.hpp (original)
+++ sandbox/threadpool/boost/future.hpp 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -4,8 +4,8 @@
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#ifndef N2561_FUTURE_HPP
-#define N2561_FUTURE_HPP
+#ifndef BOOST_FUTURE_HPP
+#define BOOST_FUTURE_HPP
#include <stdexcept>
#include <boost/exception.hpp>
#include <boost/thread.hpp>
@@ -31,7 +31,7 @@
catch ( Exception const& e) \
{ throw boost::enable_current_exception( e); }
-namespace jss
+namespace boost
{
class future_uninitialized:
public std::logic_error
@@ -1182,7 +1182,7 @@
if(!started)
{
started=true;
- this->mark_exceptional_finish_internal(boost::copy_exception(jss::broken_promise()));
+ this->mark_exceptional_finish_internal(boost::copy_exception(boost::broken_promise()));
}
}
Modified: sandbox/threadpool/boost/tp/detail/callable.hpp
==============================================================================
--- sandbox/threadpool/boost/tp/detail/callable.hpp (original)
+++ sandbox/threadpool/boost/tp/detail/callable.hpp 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -25,9 +25,9 @@
struct impl_wrapper
: public impl
{
- jss::packaged_task< T > tsk;
+ packaged_task< T > tsk;
- impl_wrapper( boost::detail::thread_move_t< jss::packaged_task< T > > const& t)
+ impl_wrapper( boost::detail::thread_move_t< packaged_task< T > > const& t)
: tsk( t)
{}
@@ -43,7 +43,7 @@
{}
template< typename T >
- callable( boost::detail::thread_move_t< jss::packaged_task< T > > const& t)
+ callable( boost::detail::thread_move_t< packaged_task< T > > const& t)
: impl_( new impl_wrapper< T >( t) )
{}
Modified: sandbox/threadpool/boost/tp/detail/interrupter.hpp
==============================================================================
--- sandbox/threadpool/boost/tp/detail/interrupter.hpp (original)
+++ sandbox/threadpool/boost/tp/detail/interrupter.hpp 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -23,16 +23,16 @@
: private noncopyable
{
private:
- bool interrupt_requested_;
+ bool interruption_requested_;
condition_variable cond_;
mutex mtx_;
shared_ptr< thread > thrd_;
void interrupt_()
{
- if ( ! interrupt_requested_)
+ if ( ! interruption_requested_)
{
- interrupt_requested_ = true;
+ interruption_requested_ = true;
if ( thrd_) thrd_->interrupt();
}
}
@@ -40,7 +40,7 @@
public:
impl()
:
- interrupt_requested_( false),
+ interruption_requested_( false),
cond_(),
mtx_(),
thrd_()
@@ -52,7 +52,7 @@
unique_lock< mutex > lk( mtx_);
thrd_ = thrd;
BOOST_ASSERT( thrd_);
- if ( interrupt_requested_) thrd_->interrupt();
+ if ( interruption_requested_) thrd_->interrupt();
}
void reset()
@@ -96,10 +96,10 @@
cond_.timed_wait( lk, rel_time);
}
- bool interrupt_requested()
+ bool interruption_requested()
{
unique_lock< mutex > lk( mtx_);
- return interrupt_requested_;
+ return interruption_requested_;
}
};
@@ -129,8 +129,8 @@
void interrupt_and_wait( DurationType const& rel_time)
{ impl_->interrupt_and_wait( rel_time); }
- bool interrupt_requested()
- { return impl_->interrupt_requested(); }
+ bool interruption_requested()
+ { return impl_->interruption_requested(); }
};
}
} }
Modified: sandbox/threadpool/boost/tp/pool.hpp
==============================================================================
--- sandbox/threadpool/boost/tp/pool.hpp (original)
+++ sandbox/threadpool/boost/tp/pool.hpp 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -51,9 +51,9 @@
namespace boost
{
template< typename T >
- detail::thread_move_t< jss::packaged_task< T > > move( jss::packaged_task< T > & t)
+ detail::thread_move_t< packaged_task< T > > move( packaged_task< T > & t)
{
- return detail::thread_move_t< jss::packaged_task< T > >( t);
+ return detail::thread_move_t< packaged_task< T > >( t);
}
}
@@ -65,7 +65,18 @@
typename Pool,
typename R
>
-void reschedule_until( jss::shared_future< R > const& f)
+void reschedule_until( unique_future< R > const& f)
+{
+ typename Pool::worker * w( Pool::tss_worker_.get() );
+ BOOST_ASSERT( w);
+ w->reschedule_until( f);
+}
+
+template<
+ typename Pool,
+ typename R
+>
+void reschedule_until( shared_future< R > const& f)
{
typename Pool::worker * w( Pool::tss_worker_.get() );
BOOST_ASSERT( w);
@@ -91,7 +102,13 @@
typename Pool,
typename R
>
- friend void this_task::reschedule_until( jss::shared_future< R > const&);
+ friend void this_task::reschedule_until( unique_future< R > const&);
+
+ template<
+ typename Pool,
+ typename R
+ >
+ friend void this_task::reschedule_until( shared_future< R > const&);
template< typename Pool >
friend Pool & this_task::get_thread_pool();
@@ -212,8 +229,8 @@
void reset_scanns()
{ scns_ = 0; }
- template< typename R >
- void reschedule_until( jss::shared_future< R > const& f)
+ template< typename F >
+ void reschedule_until( F const& f)
{ pool_ptr_->reschedule_until_( f); }
pool & get_thread_pool()
@@ -280,8 +297,8 @@
void reset_scanns()
{ impl_->reset_scanns(); }
- template< typename R >
- void reschedule_until( jss::shared_future< R > const& f)
+ template< typename F >
+ void reschedule_until( F const& f)
{ return impl_->reschedule_until( f); }
pool & get_thread_pool()
@@ -398,8 +415,8 @@
}
}
- template< typename R >
- void reschedule_until_( jss::shared_future< R > const& f)
+ template< typename F >
+ void reschedule_until_( F const& f)
{
worker * w( tss_worker_.get() );
BOOST_ASSERT( w);
@@ -722,14 +739,14 @@
{
typedef typename result_of< Act() >::type R;
detail::interrupter intr;
- jss::packaged_task< R > tsk( act);
- jss::shared_future< R > f( tsk.get_future() );
+ packaged_task< R > tsk( act);
+ shared_future< R > f( tsk.get_future() );
worker * w( tss_worker_.get() );
if ( w)
{
tsk.set_wait_callback(
bind(
- ( void ( pool::*)( jss::shared_future< R > const&) ) & pool::reschedule_until_,
+ ( void ( pool::*)( shared_future< R > const&) ) & pool::reschedule_until_,
this,
f) );
w->put( detail::callable( move( tsk) ), intr);
@@ -759,14 +776,14 @@
{
typedef typename result_of< Act() >::type R;
detail::interrupter intr;
- jss::packaged_task< R > tsk( act);
- jss::shared_future< R > f( tsk.get_future() );
+ packaged_task< R > tsk( act);
+ shared_future< R > f( tsk.get_future() );
worker * w( tss_worker_.get() );
if ( w)
{
tsk.set_wait_callback(
bind(
- ( void ( pool::*)( jss::shared_future< R > const&) ) & pool::reschedule_until_,
+ ( void ( pool::*)( shared_future< R > const&) ) & pool::reschedule_until_,
this,
f) );
w->put( detail::callable( move( tsk) ), intr);
Modified: sandbox/threadpool/boost/tp/task.hpp
==============================================================================
--- sandbox/threadpool/boost/tp/task.hpp (original)
+++ sandbox/threadpool/boost/tp/task.hpp 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -16,65 +16,16 @@
class task
{
private:
- template<
- typename T1,
- typename T2
- >
- friend void wait_for_any( task< T1 > &, task< T2 > &);
- template<
- typename T1,
- typename T2,
- typename T3
- >
- friend void wait_for_any( task< T1 > &, task< T2 > &, task< T3 > &);
- template<
- typename T1,
- typename T2,
- typename T3,
- typename T4
- >
- friend void wait_for_any( task< T1 > &, task< T2 > &, task< T3 > &, task< T4 > &);
- template<
- typename T1,
- typename T2,
- typename T3,
- typename T4,
- typename T5
- >
- friend void wait_for_any( task< T1 > &, task< T2 > &, task< T3 > &, task< T4 > &, task< T5 > &);
- template<
- typename T1,
- typename T2
- >
- friend void wait_for_all( task< T1 > &, task< T2 > &);
- template<
- typename T1,
- typename T2,
- typename T3
- >
- friend void wait_for_all( task< T1 > &, task< T2 > &, task< T3 > &);
- template<
- typename T1,
- typename T2,
- typename T3,
- typename T4
- >
- friend void wait_for_all( task< T1 > &, task< T2 > &, task< T3 > &, task< T4 > &);
- template<
- typename T1,
- typename T2,
- typename T3,
- typename T4,
- typename T5
- >
- friend void wait_for_all( task< T1 > &, task< T2 > &, task< T3 > &, task< T4 > &, task< T5 > &);
-
- jss::shared_future< R > fut_;
- detail::interrupter intr_;
+ shared_future< R > fut_;
+ detail::interrupter intr_;
public:
+ task()
+ : fut_(), intr_()
+ {}
+
task(
- jss::shared_future< R > const& fut,
+ shared_future< R > const& fut,
detail::interrupter const& intr)
:
fut_( fut),
@@ -94,95 +45,23 @@
void interrupt_and_wait( Duration const& rel_time)
{ intr_.interrupt_and_wait( rel_time); }
- bool interrupt_requested()
- { return intr_.interrupt_requested(); }
-
- R get()
- { return fut_.get(); }
-
- bool is_ready() const
- { return fut_.is_ready(); }
-
- bool has_value() const
- { return fut_.has_value(); }
-
- bool has_exception() const
- { return fut_.has_exception(); }
-
- void wait() const
- { fut_.wait(); }
+ bool interruption_requested()
+ { return intr_.interruption_requested(); }
- template< typename Duration >
- bool timed_wait( Duration const& rel_time) const
- { return fut_.timed_wait( rel_time); }
-
- bool timed_wait_until( system_time const& abs_time) const
- { return fut_.timed_wait_until( abs_time); }
+ shared_future< R > result()
+ { return fut_; }
};
template<>
class task< void >
{
private:
- template<
- typename T1,
- typename T2
- >
- friend void wait_for_any( task< T1 > &, task< T2 > &);
- template<
- typename T1,
- typename T2,
- typename T3
- >
- friend void wait_for_any( task< T1 > &, task< T2 > &, task< T3 > &);
- template<
- typename T1,
- typename T2,
- typename T3,
- typename T4
- >
- friend void wait_for_any( task< T1 > &, task< T2 > &, task< T3 > &, task< T4 > &);
- template<
- typename T1,
- typename T2,
- typename T3,
- typename T4,
- typename T5
- >
- friend void wait_for_any( task< T1 > &, task< T2 > &, task< T3 > &, task< T4 > &, task< T5 > &);
- template<
- typename T1,
- typename T2
- >
- friend void wait_for_all( task< T1 > &, task< T2 > &);
- template<
- typename T1,
- typename T2,
- typename T3
- >
- friend void wait_for_all( task< T1 > &, task< T2 > &, task< T3 > &);
- template<
- typename T1,
- typename T2,
- typename T3,
- typename T4
- >
- friend void wait_for_all( task< T1 > &, task< T2 > &, task< T3 > &, task< T4 > &);
- template<
- typename T1,
- typename T2,
- typename T3,
- typename T4,
- typename T5
- >
- friend void wait_for_all( task< T1 > &, task< T2 > &, task< T3 > &, task< T4 > &, task< T5 > &);
-
- jss::shared_future< void > fut_;
- detail::interrupter intr_;
+ shared_future< void > fut_;
+ detail::interrupter intr_;
public:
task(
- jss::shared_future< void > const& fut,
+ shared_future< void > const& fut,
detail::interrupter const& intr)
:
fut_( fut),
@@ -202,99 +81,13 @@
void interrupt_and_wait( Duration const& rel_time)
{ intr_.interrupt_and_wait( rel_time); }
- bool interrupt_requested()
- { return intr_.interrupt_requested(); }
-
- void get()
- { fut_.get(); }
-
- bool is_ready() const
- { return fut_.is_ready(); }
-
- bool has_value() const
- { return fut_.has_value(); }
-
- bool has_exception() const
- { return fut_.has_exception(); }
-
- void wait() const
- { fut_.wait(); }
-
- template< typename Duration >
- bool timed_wait( Duration const& rel_time) const
- { return fut_.timed_wait( rel_time); }
+ bool interruption_requested()
+ { return intr_.interruption_requested(); }
- bool timed_wait_until( system_time const& abs_time) const
- { return fut_.timed_wait_until( abs_time); }
+ shared_future< void > result()
+ { return fut_; }
};
-template<
- typename T1,
- typename T2
->
-void wait_for_all( task< T1 > & t1, task< T2 > & t2)
-{ jss::wait_for_all( t1.fut_, t2.fut_); };
-
-template<
- typename T1,
- typename T2,
- typename T3
->
-void wait_for_all( task< T1 > & t1, task< T2 > & t2, task< T3 > & t3)
-{ jss::wait_for_all( t1.fut_, t2.fut_, t3.fut_); };
-
-template<
- typename T1,
- typename T2,
- typename T3,
- typename T4
->
-void wait_for_all( task< T1 > & t1, task< T2 > & t2, task< T3 > & t3, task< T4 > & t4)
-{ jss::wait_for_all( t1.fut_, t2.fut_, t3.fut_, t4.fut_); };
-
-template<
- typename T1,
- typename T2,
- typename T3,
- typename T4,
- typename T5
->
-void wait_for_all( task< T1 > & t1, task< T2 > & t2, task< T3 > & t3, task< T4 > & t4, task< T5 > & t5)
-{ jss::wait_for_all( t1.fut_, t2.fut_, t3.fut_, t4.fut_, t5.fut_); };
-
-template<
- typename T1,
- typename T2
->
-void wait_for_any( task< T1 > & t1, task< T2 > & t2)
-{ jss::wait_for_any( t1.fut_, t2.fut_); };
-
-template<
- typename T1,
- typename T2,
- typename T3
->
-void wait_for_any( task< T1 > & t1, task< T2 > & t2, task< T3 > & t3)
-{ jss::wait_for_any( t1.fut_, t2.fut_, t3.fut_); };
-
-template<
- typename T1,
- typename T2,
- typename T3,
- typename T4
->
-void wait_for_any( task< T1 > & t1, task< T2 > & t2, task< T3 > & t3, task< T4 > & t4)
-{ jss::wait_for_any( t1.fut_, t2.fut_, t3.fut_, t4.fut_); };
-
-template<
- typename T1,
- typename T2,
- typename T3,
- typename T4,
- typename T5
->
-void wait_for_any( task< T1 > & t1, task< T2 > & t2, task< T3 > & t3, task< T4 > & t4, task< T5 > & t5)
-{ jss::wait_for_any( t1.fut_, t2.fut_, t3.fut_, t4.fut_, t5.fut_); };
} }
#endif // BOOST_TP_TASK_H
Modified: sandbox/threadpool/libs/tp/doc/forkjoin.qbk
==============================================================================
--- sandbox/threadpool/libs/tp/doc/forkjoin.qbk (original)
+++ sandbox/threadpool/libs/tp/doc/forkjoin.qbk 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -44,7 +44,7 @@
& fibo::par_,
boost::ref( * this),
n - 2) ) );
- return t1.get() + t2.get();
+ return t1.result().get() + t2.result().get();
}
}
@@ -85,7 +85,7 @@
std::vector< tp::task< int > >::iterator i( results.begin() );
i != e;
++i)
- std::cout << "fibonacci " << k++ << " == " << i->get() << std::endl;
+ std::cout << "fibonacci " << k++ << " == " << i->result().get() << std::endl;
pt::ptime stop( pt::microsec_clock::universal_time() );
std::cout << ( stop - start).total_milliseconds() << " milli seconds" << std::endl;
Modified: sandbox/threadpool/libs/tp/doc/html/boost_threadpool/channel.html
==============================================================================
--- sandbox/threadpool/libs/tp/doc/html/boost_threadpool/channel.html (original)
+++ sandbox/threadpool/libs/tp/doc/html/boost_threadpool/channel.html 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -34,7 +34,7 @@
action is put in.
</p>
<a name="boost_threadpool.channel.bounded_channel"></a><h4>
-<a name="id372152"></a>
+<a name="id372093"></a>
<a class="link" href="channel.html#boost_threadpool.channel.bounded_channel">bounded channel</a>
</h4>
<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span> <span class="keyword">typename</span> <span class="identifier">SchedulingPolicy</span> <span class="special">></span> <span class="keyword">class</span> <span class="identifier">bounded_channel</span>
@@ -52,7 +52,7 @@
tasks reaches low watermark.
</p>
<a name="boost_threadpool.channel.unbounded_channel"></a><h4>
-<a name="id372266"></a>
+<a name="id372209"></a>
<a class="link" href="channel.html#boost_threadpool.channel.unbounded_channel">unbounded channel</a>
</h4>
<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span> <span class="keyword">typename</span> <span class="identifier">SchedulingPolicy</span> <span class="special">></span> <span class="keyword">class</span> <span class="identifier">unbounded_channel</span>
Modified: sandbox/threadpool/libs/tp/doc/html/boost_threadpool/forkjoin.html
==============================================================================
--- sandbox/threadpool/libs/tp/doc/html/boost_threadpool/forkjoin.html (original)
+++ sandbox/threadpool/libs/tp/doc/html/boost_threadpool/forkjoin.html 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -72,7 +72,7 @@
<span class="special">&</span> <span class="identifier">fibo</span><span class="special">::</span><span class="identifier">par_</span><span class="special">,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">ref</span><span class="special">(</span> <span class="special">*</span> <span class="keyword">this</span><span class="special">),</span>
<span class="identifier">n</span> <span class="special">-</span> <span class="number">2</span><span class="special">)</span> <span class="special">)</span> <span class="special">);</span>
- <span class="keyword">return</span> <span class="identifier">t1</span><span class="special">.</span><span class="identifier">get</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">t2</span><span class="special">.</span><span class="identifier">get</span><span class="special">();</span>
+ <span class="keyword">return</span> <span class="identifier">t1</span><span class="special">.</span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">t2</span><span class="special">.</span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">();</span>
<span class="special">}</span>
<span class="special">}</span>
@@ -113,7 +113,7 @@
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span> <span class="identifier">tp</span><span class="special">::</span><span class="identifier">task</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">></span> <span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">i</span><span class="special">(</span> <span class="identifier">results</span><span class="special">.</span><span class="identifier">begin</span><span class="special">()</span> <span class="special">);</span>
<span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">e</span><span class="special">;</span>
<span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"fibonacci "</span> <span class="special"><<</span> <span class="identifier">k</span><span class="special">++</span> <span class="special"><<</span> <span class="string">" == "</span> <span class="special"><<</span> <span class="identifier">i</span><span class="special">-></span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"fibonacci "</span> <span class="special"><<</span> <span class="identifier">k</span><span class="special">++</span> <span class="special"><<</span> <span class="string">" == "</span> <span class="special"><<</span> <span class="identifier">i</span><span class="special">-></span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
<span class="identifier">pt</span><span class="special">::</span><span class="identifier">ptime</span> <span class="identifier">stop</span><span class="special">(</span> <span class="identifier">pt</span><span class="special">::</span><span class="identifier">microsec_clock</span><span class="special">::</span><span class="identifier">universal_time</span><span class="special">()</span> <span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="special">(</span> <span class="identifier">stop</span> <span class="special">-</span> <span class="identifier">start</span><span class="special">).</span><span class="identifier">total_milliseconds</span><span class="special">()</span> <span class="special"><<</span> <span class="string">" milli seconds"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
@@ -162,7 +162,7 @@
<span class="special">&</span> <span class="identifier">fibo</span><span class="special">::</span><span class="identifier">par_</span><span class="special">,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">ref</span><span class="special">(</span> <span class="special">*</span> <span class="keyword">this</span><span class="special">),</span>
<span class="identifier">n</span> <span class="special">-</span> <span class="number">2</span><span class="special">)</span> <span class="special">)</span> <span class="special">);</span>
- <span class="keyword">return</span> <span class="identifier">t1</span><span class="special">.</span><span class="identifier">get</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">t2</span><span class="special">.</span><span class="identifier">get</span><span class="special">();</span>
+ <span class="keyword">return</span> <span class="identifier">t1</span><span class="special">.</span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">t2</span><span class="special">.</span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">();</span>
<span class="special">}</span>
<span class="special">}</span>
@@ -203,7 +203,7 @@
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span> <span class="identifier">tp</span><span class="special">::</span><span class="identifier">task</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">></span> <span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">i</span><span class="special">(</span> <span class="identifier">results</span><span class="special">.</span><span class="identifier">begin</span><span class="special">()</span> <span class="special">);</span>
<span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">e</span><span class="special">;</span>
<span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"fibonacci "</span> <span class="special"><<</span> <span class="identifier">k</span><span class="special">++</span> <span class="special"><<</span> <span class="string">" == "</span> <span class="special"><<</span> <span class="identifier">i</span><span class="special">-></span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"fibonacci "</span> <span class="special"><<</span> <span class="identifier">k</span><span class="special">++</span> <span class="special"><<</span> <span class="string">" == "</span> <span class="special"><<</span> <span class="identifier">i</span><span class="special">-></span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
<span class="identifier">pt</span><span class="special">::</span><span class="identifier">ptime</span> <span class="identifier">stop</span><span class="special">(</span> <span class="identifier">pt</span><span class="special">::</span><span class="identifier">microsec_clock</span><span class="special">::</span><span class="identifier">universal_time</span><span class="special">()</span> <span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="special">(</span> <span class="identifier">stop</span> <span class="special">-</span> <span class="identifier">start</span><span class="special">).</span><span class="identifier">total_milliseconds</span><span class="special">()</span> <span class="special"><<</span> <span class="string">" milli seconds"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
@@ -249,7 +249,7 @@
<span class="special">&</span> <span class="identifier">fibo</span><span class="special">::</span><span class="identifier">par_</span><span class="special">,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">ref</span><span class="special">(</span> <span class="special">*</span> <span class="keyword">this</span><span class="special">),</span>
<span class="identifier">n</span> <span class="special">-</span> <span class="number">2</span><span class="special">)</span> <span class="special">)</span> <span class="special">);</span>
- <span class="keyword">return</span> <span class="identifier">t1</span><span class="special">.</span><span class="identifier">get</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">t2</span><span class="special">.</span><span class="identifier">get</span><span class="special">();</span>
+ <span class="keyword">return</span> <span class="identifier">t1</span><span class="special">.</span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">t2</span><span class="special">.</span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">();</span>
<span class="special">}</span>
<span class="special">}</span>
@@ -290,7 +290,7 @@
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span> <span class="identifier">tp</span><span class="special">::</span><span class="identifier">task</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">></span> <span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">i</span><span class="special">(</span> <span class="identifier">results</span><span class="special">.</span><span class="identifier">begin</span><span class="special">()</span> <span class="special">);</span>
<span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">e</span><span class="special">;</span>
<span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"fibonacci "</span> <span class="special"><<</span> <span class="identifier">k</span><span class="special">++</span> <span class="special"><<</span> <span class="string">" == "</span> <span class="special"><<</span> <span class="identifier">i</span><span class="special">-></span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"fibonacci "</span> <span class="special"><<</span> <span class="identifier">k</span><span class="special">++</span> <span class="special"><<</span> <span class="string">" == "</span> <span class="special"><<</span> <span class="identifier">i</span><span class="special">-></span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
<span class="identifier">pt</span><span class="special">::</span><span class="identifier">ptime</span> <span class="identifier">stop</span><span class="special">(</span> <span class="identifier">pt</span><span class="special">::</span><span class="identifier">microsec_clock</span><span class="special">::</span><span class="identifier">universal_time</span><span class="special">()</span> <span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="special">(</span> <span class="identifier">stop</span> <span class="special">-</span> <span class="identifier">start</span><span class="special">).</span><span class="identifier">total_milliseconds</span><span class="special">()</span> <span class="special"><<</span> <span class="string">" milli seconds"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
@@ -331,7 +331,7 @@
<span class="special">&</span> <span class="identifier">fibo</span><span class="special">::</span><span class="identifier">par_</span><span class="special">,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">ref</span><span class="special">(</span> <span class="special">*</span> <span class="keyword">this</span><span class="special">),</span>
<span class="identifier">n</span> <span class="special">-</span> <span class="number">2</span><span class="special">)</span> <span class="special">)</span> <span class="special">);</span>
- <span class="keyword">return</span> <span class="identifier">t1</span><span class="special">.</span><span class="identifier">get</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">t2</span><span class="special">.</span><span class="identifier">get</span><span class="special">();</span>
+ <span class="keyword">return</span> <span class="identifier">t1</span><span class="special">.</span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">t2</span><span class="special">.</span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">();</span>
<span class="special">}</span>
<span class="special">}</span>
@@ -372,7 +372,7 @@
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span> <span class="identifier">tp</span><span class="special">::</span><span class="identifier">task</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">></span> <span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">i</span><span class="special">(</span> <span class="identifier">results</span><span class="special">.</span><span class="identifier">begin</span><span class="special">()</span> <span class="special">);</span>
<span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">e</span><span class="special">;</span>
<span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"fibonacci "</span> <span class="special"><<</span> <span class="identifier">k</span><span class="special">++</span> <span class="special"><<</span> <span class="string">" == "</span> <span class="special"><<</span> <span class="identifier">i</span><span class="special">-></span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"fibonacci "</span> <span class="special"><<</span> <span class="identifier">k</span><span class="special">++</span> <span class="special"><<</span> <span class="string">" == "</span> <span class="special"><<</span> <span class="identifier">i</span><span class="special">-></span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
<span class="identifier">pt</span><span class="special">::</span><span class="identifier">ptime</span> <span class="identifier">stop</span><span class="special">(</span> <span class="identifier">pt</span><span class="special">::</span><span class="identifier">microsec_clock</span><span class="special">::</span><span class="identifier">universal_time</span><span class="special">()</span> <span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="special">(</span> <span class="identifier">stop</span> <span class="special">-</span> <span class="identifier">start</span><span class="special">).</span><span class="identifier">total_milliseconds</span><span class="special">()</span> <span class="special"><<</span> <span class="string">" milli seconds"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
@@ -408,7 +408,7 @@
<span class="special">&</span> <span class="identifier">fibo</span><span class="special">::</span><span class="identifier">par_</span><span class="special">,</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">ref</span><span class="special">(</span> <span class="special">*</span> <span class="keyword">this</span><span class="special">),</span>
<span class="identifier">n</span> <span class="special">-</span> <span class="number">2</span><span class="special">)</span> <span class="special">)</span> <span class="special">);</span>
- <span class="keyword">return</span> <span class="identifier">t1</span><span class="special">.</span><span class="identifier">get</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">t2</span><span class="special">.</span><span class="identifier">get</span><span class="special">();</span>
+ <span class="keyword">return</span> <span class="identifier">t1</span><span class="special">.</span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">()</span> <span class="special">+</span> <span class="identifier">t2</span><span class="special">.</span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">();</span>
<span class="special">}</span>
<span class="special">}</span>
@@ -449,7 +449,7 @@
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span> <span class="identifier">tp</span><span class="special">::</span><span class="identifier">task</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">></span> <span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">i</span><span class="special">(</span> <span class="identifier">results</span><span class="special">.</span><span class="identifier">begin</span><span class="special">()</span> <span class="special">);</span>
<span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">e</span><span class="special">;</span>
<span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"fibonacci "</span> <span class="special"><<</span> <span class="identifier">k</span><span class="special">++</span> <span class="special"><<</span> <span class="string">" == "</span> <span class="special"><<</span> <span class="identifier">i</span><span class="special">-></span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"fibonacci "</span> <span class="special"><<</span> <span class="identifier">k</span><span class="special">++</span> <span class="special"><<</span> <span class="string">" == "</span> <span class="special"><<</span> <span class="identifier">i</span><span class="special">-></span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
<span class="identifier">pt</span><span class="special">::</span><span class="identifier">ptime</span> <span class="identifier">stop</span><span class="special">(</span> <span class="identifier">pt</span><span class="special">::</span><span class="identifier">microsec_clock</span><span class="special">::</span><span class="identifier">universal_time</span><span class="special">()</span> <span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="special">(</span> <span class="identifier">stop</span> <span class="special">-</span> <span class="identifier">start</span><span class="special">).</span><span class="identifier">total_milliseconds</span><span class="special">()</span> <span class="special"><<</span> <span class="string">" milli seconds"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
@@ -470,7 +470,8 @@
pool<span class="underline">type >().submit( boost::bind( & fibo::par</span>,
boost::ref( * this), n - 1) ) ); tp::task< int > t2( boost::this_task::get_thread_pool<
pool<span class="underline">type >().submit( boost::bind( & fibo::par</span>,
- boost::ref( * this), n - 2) ) ); return t1.get() + t2.get(); } }
+ boost::ref( * this), n - 2) ) ); return t1.result().get() + t2.result().get();
+ } }
</p>
<pre class="programlisting"><span class="keyword">public</span><span class="special">:</span>
<span class="identifier">fibo</span><span class="special">(</span> <span class="keyword">int</span> <span class="identifier">offset</span><span class="special">)</span>
@@ -509,7 +510,7 @@
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span> <span class="identifier">tp</span><span class="special">::</span><span class="identifier">task</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">></span> <span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">i</span><span class="special">(</span> <span class="identifier">results</span><span class="special">.</span><span class="identifier">begin</span><span class="special">()</span> <span class="special">);</span>
<span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">e</span><span class="special">;</span>
<span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"fibonacci "</span> <span class="special"><<</span> <span class="identifier">k</span><span class="special">++</span> <span class="special"><<</span> <span class="string">" == "</span> <span class="special"><<</span> <span class="identifier">i</span><span class="special">-></span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"fibonacci "</span> <span class="special"><<</span> <span class="identifier">k</span><span class="special">++</span> <span class="special"><<</span> <span class="string">" == "</span> <span class="special"><<</span> <span class="identifier">i</span><span class="special">-></span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
<span class="identifier">pt</span><span class="special">::</span><span class="identifier">ptime</span> <span class="identifier">stop</span><span class="special">(</span> <span class="identifier">pt</span><span class="special">::</span><span class="identifier">microsec_clock</span><span class="special">::</span><span class="identifier">universal_time</span><span class="special">()</span> <span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="special">(</span> <span class="identifier">stop</span> <span class="special">-</span> <span class="identifier">start</span><span class="special">).</span><span class="identifier">total_milliseconds</span><span class="special">()</span> <span class="special"><<</span> <span class="string">" milli seconds"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
@@ -559,7 +560,7 @@
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span> <span class="identifier">tp</span><span class="special">::</span><span class="identifier">task</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">></span> <span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">i</span><span class="special">(</span> <span class="identifier">results</span><span class="special">.</span><span class="identifier">begin</span><span class="special">()</span> <span class="special">);</span>
<span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">e</span><span class="special">;</span>
<span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"fibonacci "</span> <span class="special"><<</span> <span class="identifier">k</span><span class="special">++</span> <span class="special"><<</span> <span class="string">" == "</span> <span class="special"><<</span> <span class="identifier">i</span><span class="special">-></span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"fibonacci "</span> <span class="special"><<</span> <span class="identifier">k</span><span class="special">++</span> <span class="special"><<</span> <span class="string">" == "</span> <span class="special"><<</span> <span class="identifier">i</span><span class="special">-></span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
<span class="identifier">pt</span><span class="special">::</span><span class="identifier">ptime</span> <span class="identifier">stop</span><span class="special">(</span> <span class="identifier">pt</span><span class="special">::</span><span class="identifier">microsec_clock</span><span class="special">::</span><span class="identifier">universal_time</span><span class="special">()</span> <span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="special">(</span> <span class="identifier">stop</span> <span class="special">-</span> <span class="identifier">start</span><span class="special">).</span><span class="identifier">total_milliseconds</span><span class="special">()</span> <span class="special"><<</span> <span class="string">" milli seconds"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
@@ -602,7 +603,7 @@
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span> <span class="identifier">tp</span><span class="special">::</span><span class="identifier">task</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">></span> <span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">i</span><span class="special">(</span> <span class="identifier">results</span><span class="special">.</span><span class="identifier">begin</span><span class="special">()</span> <span class="special">);</span>
<span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">e</span><span class="special">;</span>
<span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"fibonacci "</span> <span class="special"><<</span> <span class="identifier">k</span><span class="special">++</span> <span class="special"><<</span> <span class="string">" == "</span> <span class="special"><<</span> <span class="identifier">i</span><span class="special">-></span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"fibonacci "</span> <span class="special"><<</span> <span class="identifier">k</span><span class="special">++</span> <span class="special"><<</span> <span class="string">" == "</span> <span class="special"><<</span> <span class="identifier">i</span><span class="special">-></span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
<span class="identifier">pt</span><span class="special">::</span><span class="identifier">ptime</span> <span class="identifier">stop</span><span class="special">(</span> <span class="identifier">pt</span><span class="special">::</span><span class="identifier">microsec_clock</span><span class="special">::</span><span class="identifier">universal_time</span><span class="special">()</span> <span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="special">(</span> <span class="identifier">stop</span> <span class="special">-</span> <span class="identifier">start</span><span class="special">).</span><span class="identifier">total_milliseconds</span><span class="special">()</span> <span class="special"><<</span> <span class="string">" milli seconds"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
@@ -638,7 +639,7 @@
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span> <span class="identifier">tp</span><span class="special">::</span><span class="identifier">task</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">></span> <span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">i</span><span class="special">(</span> <span class="identifier">results</span><span class="special">.</span><span class="identifier">begin</span><span class="special">()</span> <span class="special">);</span>
<span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">e</span><span class="special">;</span>
<span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"fibonacci "</span> <span class="special"><<</span> <span class="identifier">k</span><span class="special">++</span> <span class="special"><<</span> <span class="string">" == "</span> <span class="special"><<</span> <span class="identifier">i</span><span class="special">-></span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"fibonacci "</span> <span class="special"><<</span> <span class="identifier">k</span><span class="special">++</span> <span class="special"><<</span> <span class="string">" == "</span> <span class="special"><<</span> <span class="identifier">i</span><span class="special">-></span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
<span class="identifier">pt</span><span class="special">::</span><span class="identifier">ptime</span> <span class="identifier">stop</span><span class="special">(</span> <span class="identifier">pt</span><span class="special">::</span><span class="identifier">microsec_clock</span><span class="special">::</span><span class="identifier">universal_time</span><span class="special">()</span> <span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="special">(</span> <span class="identifier">stop</span> <span class="special">-</span> <span class="identifier">start</span><span class="special">).</span><span class="identifier">total_milliseconds</span><span class="special">()</span> <span class="special"><<</span> <span class="string">" milli seconds"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
@@ -670,7 +671,7 @@
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span> <span class="identifier">tp</span><span class="special">::</span><span class="identifier">task</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">></span> <span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">i</span><span class="special">(</span> <span class="identifier">results</span><span class="special">.</span><span class="identifier">begin</span><span class="special">()</span> <span class="special">);</span>
<span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">e</span><span class="special">;</span>
<span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"fibonacci "</span> <span class="special"><<</span> <span class="identifier">k</span><span class="special">++</span> <span class="special"><<</span> <span class="string">" == "</span> <span class="special"><<</span> <span class="identifier">i</span><span class="special">-></span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"fibonacci "</span> <span class="special"><<</span> <span class="identifier">k</span><span class="special">++</span> <span class="special"><<</span> <span class="string">" == "</span> <span class="special"><<</span> <span class="identifier">i</span><span class="special">-></span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
<span class="identifier">pt</span><span class="special">::</span><span class="identifier">ptime</span> <span class="identifier">stop</span><span class="special">(</span> <span class="identifier">pt</span><span class="special">::</span><span class="identifier">microsec_clock</span><span class="special">::</span><span class="identifier">universal_time</span><span class="special">()</span> <span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="special">(</span> <span class="identifier">stop</span> <span class="special">-</span> <span class="identifier">start</span><span class="special">).</span><span class="identifier">total_milliseconds</span><span class="special">()</span> <span class="special"><<</span> <span class="string">" milli seconds"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
@@ -695,7 +696,7 @@
<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span> <span class="identifier">tp</span><span class="special">::</span><span class="identifier">task</span><span class="special"><</span> <span class="keyword">int</span> <span class="special">></span> <span class="special">>::</span><span class="identifier">iterator</span> <span class="identifier">i</span><span class="special">(</span> <span class="identifier">results</span><span class="special">.</span><span class="identifier">begin</span><span class="special">()</span> <span class="special">);</span>
<span class="identifier">i</span> <span class="special">!=</span> <span class="identifier">e</span><span class="special">;</span>
<span class="special">++</span><span class="identifier">i</span><span class="special">)</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"fibonacci "</span> <span class="special"><<</span> <span class="identifier">k</span><span class="special">++</span> <span class="special"><<</span> <span class="string">" == "</span> <span class="special"><<</span> <span class="identifier">i</span><span class="special">-></span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"fibonacci "</span> <span class="special"><<</span> <span class="identifier">k</span><span class="special">++</span> <span class="special"><<</span> <span class="string">" == "</span> <span class="special"><<</span> <span class="identifier">i</span><span class="special">-></span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
<span class="identifier">pt</span><span class="special">::</span><span class="identifier">ptime</span> <span class="identifier">stop</span><span class="special">(</span> <span class="identifier">pt</span><span class="special">::</span><span class="identifier">microsec_clock</span><span class="special">::</span><span class="identifier">universal_time</span><span class="special">()</span> <span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="special">(</span> <span class="identifier">stop</span> <span class="special">-</span> <span class="identifier">start</span><span class="special">).</span><span class="identifier">total_milliseconds</span><span class="special">()</span> <span class="special"><<</span> <span class="string">" milli seconds"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
@@ -714,7 +715,7 @@
int k = 0; std::vector< tp::task< int > >::iterator e( results.end()
); for ( std::vector< tp::task< int > >::iterator i( results.begin()
); i != e; ++i) std::cout << "fibonacci " << k++ <<
- " == " << i->get() << std::endl;
+ " == " << i->result().get() << std::endl;
</p>
<pre class="programlisting"> <span class="identifier">pt</span><span class="special">::</span><span class="identifier">ptime</span> <span class="identifier">stop</span><span class="special">(</span> <span class="identifier">pt</span><span class="special">::</span><span class="identifier">microsec_clock</span><span class="special">::</span><span class="identifier">universal_time</span><span class="special">()</span> <span class="special">);</span>
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="special">(</span> <span class="identifier">stop</span> <span class="special">-</span> <span class="identifier">start</span><span class="special">).</span><span class="identifier">total_milliseconds</span><span class="special">()</span> <span class="special"><<</span> <span class="string">" milli seconds"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
Modified: sandbox/threadpool/libs/tp/doc/html/boost_threadpool/pool.html
==============================================================================
--- sandbox/threadpool/libs/tp/doc/html/boost_threadpool/pool.html (original)
+++ sandbox/threadpool/libs/tp/doc/html/boost_threadpool/pool.html 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -200,11 +200,11 @@
<span class="identifier">pool</span><span class="special">.</span><span class="identifier">shutdown</span><span class="special">();</span>
-<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">t1</span><span class="special">.</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// 55
-</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">t2</span><span class="special">.</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// 55
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">t1</span><span class="special">.</span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// 55
+</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">t2</span><span class="special">.</span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// 55
</span></pre>
<a name="boost_threadpool.pool.shutdown_immediatly"></a><h4>
-<a name="id368828"></a>
+<a name="id368845"></a>
<a class="link" href="pool.html#boost_threadpool.pool.shutdown_immediatly">Shutdown immediatly</a>
</h4>
<p>
@@ -225,7 +225,7 @@
</p></td></tr>
</table></div>
<a name="boost_threadpool.pool.meta_functions"></a><h4>
-<a name="id368961"></a>
+<a name="id368978"></a>
<a class="link" href="pool.html#boost_threadpool.pool.meta_functions">Meta functions</a>
</h4>
<p>
@@ -249,7 +249,7 @@
<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">boolalpha</span> <span class="special"><<</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">tp</span><span class="special">::</span><span class="identifier">has_fibers</span><span class="special"><</span> <span class="identifier">pool_type</span> <span class="special">>::</span><span class="identifier">value</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
</pre>
<a name="boost_threadpool.pool.processor_binding"></a><h4>
-<a name="id369535"></a>
+<a name="id369552"></a>
<a class="link" href="pool.html#boost_threadpool.pool.processor_binding">Processor binding</a>
</h4>
<p>
Modified: sandbox/threadpool/libs/tp/doc/html/boost_threadpool/reference.html
==============================================================================
--- sandbox/threadpool/libs/tp/doc/html/boost_threadpool/reference.html (original)
+++ sandbox/threadpool/libs/tp/doc/html/boost_threadpool/reference.html 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -28,10 +28,6 @@
<div class="toc"><dl>
<dt><span class="section"> Class template pool
</span></dt>
<dt><span class="section"> Class template task
</span></dt>
-<dt><span class="section"><a href="reference.html#boost_threadpool.reference.wait_for_all"> Non-member
- function <code class="computeroutput"><span class="identifier">wait_for_all</span></code></a></span></dt>
-<dt><span class="section"><a href="reference.html#boost_threadpool.reference.wait_for_any"> Non-member
- function <code class="computeroutput"><span class="identifier">wait_for_any</span></code></a></span></dt>
<dt><span class="section"><a href="reference.html#boost_threadpool.reference.reschedule_until"> Non-member
function <code class="computeroutput"><span class="identifier">reschedule_until</span></code></a></span></dt>
<dt><span class="section"><a href="reference.html#boost_threadpool.reference.get_thread_pool"> Non-member
@@ -762,20 +758,8 @@
function <code class="computeroutput"><span class="identifier">interrupt</span><span class="special">()</span></code></a></span></dt>
<dt><span class="section"><a href="reference.html#boost_threadpool.reference.task.interrupt_and_wait">
Member function <code class="computeroutput"><span class="identifier">interrupt_and_wait</span><span class="special">()</span></code></a></span></dt>
-<dt><span class="section"><a href="reference.html#boost_threadpool.reference.task.get"> Member function
- <code class="computeroutput"><span class="identifier">get</span><span class="special">()</span></code></a></span></dt>
-<dt><span class="section"><a href="reference.html#boost_threadpool.reference.task.is_read"> Member function
- <code class="computeroutput"><span class="identifier">is_ready</span><span class="special">()</span></code></a></span></dt>
-<dt><span class="section"><a href="reference.html#boost_threadpool.reference.task.has_value"> Member
- function <code class="computeroutput"><span class="identifier">has_value</span><span class="special">()</span></code></a></span></dt>
-<dt><span class="section"><a href="reference.html#boost_threadpool.reference.task.has_exception"> Member
- function <code class="computeroutput"><span class="identifier">has_exception</span><span class="special">()</span></code></a></span></dt>
-<dt><span class="section"><a href="reference.html#boost_threadpool.reference.task.wait"> Member function
- <code class="computeroutput"><span class="identifier">wait</span><span class="special">()</span></code></a></span></dt>
-<dt><span class="section"><a href="reference.html#boost_threadpool.reference.task.timed_wait"> Member
- function <code class="computeroutput"><span class="identifier">timed_wait</span><span class="special">()</span></code></a></span></dt>
-<dt><span class="section"><a href="reference.html#boost_threadpool.reference.task.timed_wait_until">
- Member function <code class="computeroutput"><span class="identifier">timed_wait_until</span><span class="special">()</span></code></a></span></dt>
+<dt><span class="section"><a href="reference.html#boost_threadpool.reference.task.result"> Member function
+ <code class="computeroutput"><span class="identifier">result</span><span class="special">()</span></code></a></span></dt>
</dl></div>
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">tp</span><span class="special">/</span><span class="identifier">task</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
@@ -786,7 +770,7 @@
<span class="keyword">template</span><span class="special"><</span> <span class="keyword">typename</span> <span class="identifier">Pool</span> <span class="special">></span>
<span class="identifier">task</span><span class="special">(</span>
<span class="identifier">Pool</span> <span class="special">*</span> <span class="identifier">pool</span><span class="special">,</span>
- <span class="identifier">future</span><span class="special"><</span> <span class="identifier">R</span> <span class="special">></span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">fut</span><span class="special">,</span>
+ <span class="identifier">shared_future</span><span class="special"><</span> <span class="identifier">R</span> <span class="special">></span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">fut</span><span class="special">,</span>
<span class="identifier">detail</span><span class="special">::</span><span class="identifier">interrupter</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">intr</span><span class="special">);</span>
<span class="keyword">void</span> <span class="identifier">interrupt</span><span class="special">();</span>
@@ -796,16 +780,7 @@
<span class="keyword">void</span> <span class="identifier">interrupt_and_wait</span><span class="special">(</span> <span class="identifier">Duration</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">rel_time</span><span class="special">);</span>
<span class="keyword">bool</span> <span class="identifier">interrupt_requested</span><span class="special">();</span>
- <span class="identifier">R</span> <span class="identifier">get</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
-
- <span class="keyword">bool</span> <span class="identifier">is_ready</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
- <span class="keyword">bool</span> <span class="identifier">has_value</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
- <span class="keyword">bool</span> <span class="identifier">has_exception</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
-
- <span class="keyword">void</span> <span class="identifier">wait</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
- <span class="keyword">template</span><span class="special"><</span> <span class="keyword">typename</span> <span class="identifier">Duration</span> <span class="special">></span>
- <span class="keyword">bool</span> <span class="identifier">timed_wait</span><span class="special">(</span> <span class="identifier">Duration</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">rel_time</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
- <span class="keyword">bool</span> <span class="identifier">timed_wait_until</span><span class="special">(</span> <span class="identifier">system_time</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">abs_time</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
+ <span class="identifier">shared_future</span><span class="special"><</span> <span class="identifier">R</span> <span class="special">></span> <span class="identifier">result</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
<span class="special">};</span>
</pre>
<div class="section" lang="en">
@@ -815,7 +790,7 @@
<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span> <span class="keyword">typename</span> <span class="identifier">Pool</span> <span class="special">></span>
<span class="identifier">task</span><span class="special">(</span>
<span class="identifier">Pool</span> <span class="special">*</span> <span class="identifier">pool</span><span class="special">,</span>
- <span class="identifier">future</span><span class="special"><</span> <span class="identifier">R</span> <span class="special">></span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">fut</span><span class="special">,</span>
+ <span class="identifier">shared_future</span><span class="special"><</span> <span class="identifier">R</span> <span class="special">></span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">fut</span><span class="special">,</span>
<span class="identifier">detail</span><span class="special">::</span><span class="identifier">interrupter</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">intr</span><span class="special">);</span>
</pre>
<div class="variablelist">
@@ -892,17 +867,17 @@
</div>
<div class="section" lang="en">
<div class="titlepage"><div><div><h4 class="title">
-<a name="boost_threadpool.reference.task.get"></a><a class="link" href="reference.html#boost_threadpool.reference.task.get" title="Member function get()"> Member function
- <code class="computeroutput"><span class="identifier">get</span><span class="special">()</span></code></a>
+<a name="boost_threadpool.reference.task.result"></a><a class="link" href="reference.html#boost_threadpool.reference.task.result" title="Member function result()"> Member function
+ <code class="computeroutput"><span class="identifier">result</span><span class="special">()</span></code></a>
</h4></div></div></div>
-<pre class="programlisting"><span class="identifier">R</span> <span class="identifier">get</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
+<pre class="programlisting"><span class="identifier">shared_future</span><span class="special"><</span> <span class="identifier">R</span> <span class="special">></span> <span class="identifier">result</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
</pre>
<div class="variablelist">
<p class="title"><b></b></p>
<dl>
<dt><span class="term">Effects:</span></dt>
<dd><p>
- Returns fulfilled value or throws fulfilled exception.
+ Returns fulfilled value or throws fulfilled exception via a shared_future.
</p></dd>
<dt><span class="term">Throws:</span></dt>
<dd><p>
@@ -911,204 +886,6 @@
</dl>
</div>
</div>
-<div class="section" lang="en">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="boost_threadpool.reference.task.is_read"></a><a class="link" href="reference.html#boost_threadpool.reference.task.is_read" title="Member function is_ready()"> Member function
- <code class="computeroutput"><span class="identifier">is_ready</span><span class="special">()</span></code></a>
-</h4></div></div></div>
-<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">is_ready</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
-</pre>
-<div class="variablelist">
-<p class="title"><b></b></p>
-<dl>
-<dt><span class="term">Effects:</span></dt>
-<dd><p>
- Queries if the action has been fulfilled.
- </p></dd>
-<dt><span class="term">Throws:</span></dt>
-<dd><p>
- Nothing
- </p></dd>
-</dl>
-</div>
-</div>
-<div class="section" lang="en">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="boost_threadpool.reference.task.has_value"></a><a class="link" href="reference.html#boost_threadpool.reference.task.has_value" title="Member function has_value()"> Member
- function <code class="computeroutput"><span class="identifier">has_value</span><span class="special">()</span></code></a>
-</h4></div></div></div>
-<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">has_value</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
-</pre>
-<div class="variablelist">
-<p class="title"><b></b></p>
-<dl>
-<dt><span class="term">Effects:</span></dt>
-<dd><p>
- Queries if the action has been fulfilled (is ready) and has a value.
- </p></dd>
-<dt><span class="term">Throws:</span></dt>
-<dd><p>
- Nothing
- </p></dd>
-</dl>
-</div>
-</div>
-<div class="section" lang="en">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="boost_threadpool.reference.task.has_exception"></a><a class="link" href="reference.html#boost_threadpool.reference.task.has_exception" title="Member function has_exception()"> Member
- function <code class="computeroutput"><span class="identifier">has_exception</span><span class="special">()</span></code></a>
-</h4></div></div></div>
-<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">has_exception</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
-</pre>
-<div class="variablelist">
-<p class="title"><b></b></p>
-<dl>
-<dt><span class="term">Effects:</span></dt>
-<dd><p>
- Queries if the action has been fulfilled (is ready) and has an exception.
- </p></dd>
-<dt><span class="term">Throws:</span></dt>
-<dd><p>
- Nothing
- </p></dd>
-</dl>
-</div>
-</div>
-<div class="section" lang="en">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="boost_threadpool.reference.task.wait"></a><a class="link" href="reference.html#boost_threadpool.reference.task.wait" title="Member function wait()"> Member function
- <code class="computeroutput"><span class="identifier">wait</span><span class="special">()</span></code></a>
-</h4></div></div></div>
-<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">wait</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
-</pre>
-<div class="variablelist">
-<p class="title"><b></b></p>
-<dl>
-<dt><span class="term">Effects:</span></dt>
-<dd><p>
- Waits until the result is ready.
- </p></dd>
-<dt><span class="term">Throws:</span></dt>
-<dd><p>
- Throws thread_interrupted if the result is not ready at the point of
- the call, and the current thread is interrupted.
- </p></dd>
-</dl>
-</div>
-</div>
-<div class="section" lang="en">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="boost_threadpool.reference.task.timed_wait"></a><a class="link" href="reference.html#boost_threadpool.reference.task.timed_wait" title="Member function timed_wait()"> Member
- function <code class="computeroutput"><span class="identifier">timed_wait</span><span class="special">()</span></code></a>
-</h4></div></div></div>
-<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span> <span class="keyword">typename</span> <span class="identifier">Duration</span> <span class="special">></span>
-<span class="keyword">bool</span> <span class="identifier">timed_wait</span><span class="special">(</span> <span class="identifier">Duration</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">wait_duration</span><span class="special">);</span>
-</pre>
-<div class="variablelist">
-<p class="title"><b></b></p>
-<dl>
-<dt><span class="term">Effects:</span></dt>
-<dd><p>
- Waits until the result is ready, or returns false if the time specified
- by wait_duration has elapsed.
- </p></dd>
-<dt><span class="term">Throws:</span></dt>
-<dd><p>
- Throws thread_interrupted if the result is not ready at the point of
- the call, and the current thread is interrupted.
- </p></dd>
-</dl>
-</div>
-</div>
-<div class="section" lang="en">
-<div class="titlepage"><div><div><h4 class="title">
-<a name="boost_threadpool.reference.task.timed_wait_until"></a><a class="link" href="reference.html#boost_threadpool.reference.task.timed_wait_until" title="Member function timed_wait_until()">
- Member function <code class="computeroutput"><span class="identifier">timed_wait_until</span><span class="special">()</span></code></a>
-</h4></div></div></div>
-<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">timed_wait_until</span><span class="special">(</span> <span class="identifier">system_time</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">wait_timeout</span><span class="special">);</span>
-</pre>
-<div class="variablelist">
-<p class="title"><b></b></p>
-<dl>
-<dt><span class="term">Effects:</span></dt>
-<dd><p>
- Waits until the result is ready, or returns false if the time point
- specified by wait_timeout has passed.
- </p></dd>
-<dt><span class="term">Throws:</span></dt>
-<dd><p>
- Throws thread_interrupted if the result is not ready at the point of
- the call, and the current thread is interrupted.
- </p></dd>
-</dl>
-</div>
-</div>
-</div>
-<div class="section" lang="en">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="boost_threadpool.reference.wait_for_all"></a><a class="link" href="reference.html#boost_threadpool.reference.wait_for_all" title="Non-member function wait_for_all"> Non-member
- function <code class="computeroutput"><span class="identifier">wait_for_all</span></code></a>
-</h3></div></div></div>
-<pre class="programlisting"> <span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">tp</span><span class="special">/</span><span class="identifier">task</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
-
-<span class="keyword">template</span><span class="special"><</span> <span class="keyword">typename</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T2</span> <span class="special">></span>
-<span class="keyword">void</span> <span class="identifier">wait_for_all</span><span class="special">(</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T1</span> <span class="special">></span> <span class="special">&,</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T2</span> <span class="special">></span> <span class="special">&);</span>
-
-<span class="keyword">template</span><span class="special"><</span> <span class="keyword">typename</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T3</span> <span class="special">></span>
-<span class="keyword">void</span> <span class="identifier">wait_for_all</span><span class="special">(</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T1</span> <span class="special">></span> <span class="special">&,</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T2</span> <span class="special">></span> <span class="special">&,</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T3</span> <span class="special">></span> <span class="special">&);</span>
-
-<span class="keyword">template</span><span class="special"><</span> <span class="keyword">typename</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T3</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T4</span> <span class="special">></span>
-<span class="keyword">void</span> <span class="identifier">wait_for_all</span><span class="special">(</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T1</span> <span class="special">></span> <span class="special">&,</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T2</span> <span class="special">></span> <span class="special">&,</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T3</span> <span class="special">></span> <span class="special">&,</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T4</span> <span class="special">></span> <span class="special">&);</span>
-
-<span class="keyword">template</span><span class="special"><</span> <span class="keyword">typename</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T3</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T4</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T5</span> <span class="special">></span>
-<span class="keyword">void</span> <span class="identifier">wait_for_all</span><span class="special">(</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T1</span> <span class="special">></span> <span class="special">&,</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T2</span> <span class="special">></span> <span class="special">&,</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T3</span> <span class="special">></span> <span class="special">&,</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T4</span> <span class="special">></span> <span class="special">&,</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T5</span> <span class="special">></span> <span class="special">&);</span>
-</pre>
-<div class="variablelist">
-<p class="title"><b></b></p>
-<dl>
-<dt><span class="term">Effects:</span></dt>
-<dd><p>
- Waits until all specified tasks are ready.
- </p></dd>
-<dt><span class="term">Throws:</span></dt>
-<dd><p>
- Any exceptions that might be thrown by the actions.
- </p></dd>
-</dl>
-</div>
-</div>
-<div class="section" lang="en">
-<div class="titlepage"><div><div><h3 class="title">
-<a name="boost_threadpool.reference.wait_for_any"></a><a class="link" href="reference.html#boost_threadpool.reference.wait_for_any" title="Non-member function wait_for_any"> Non-member
- function <code class="computeroutput"><span class="identifier">wait_for_any</span></code></a>
-</h3></div></div></div>
-<pre class="programlisting"> <span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">tp</span><span class="special">/</span><span class="identifier">task</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
-
-<span class="keyword">template</span><span class="special"><</span> <span class="keyword">typename</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T2</span> <span class="special">></span>
-<span class="keyword">void</span> <span class="identifier">wait_for_any</span><span class="special">(</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T1</span> <span class="special">></span> <span class="special">&,</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T2</span> <span class="special">></span> <span class="special">&);</span>
-
-<span class="keyword">template</span><span class="special"><</span> <span class="keyword">typename</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T3</span> <span class="special">></span>
-<span class="keyword">void</span> <span class="identifier">wait_for_any</span><span class="special">(</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T1</span> <span class="special">></span> <span class="special">&,</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T2</span> <span class="special">></span> <span class="special">&,</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T3</span> <span class="special">></span> <span class="special">&);</span>
-
-<span class="keyword">template</span><span class="special"><</span> <span class="keyword">typename</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T3</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T4</span> <span class="special">></span>
-<span class="keyword">void</span> <span class="identifier">wait_for_any</span><span class="special">(</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T1</span> <span class="special">></span> <span class="special">&,</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T2</span> <span class="special">></span> <span class="special">&,</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T3</span> <span class="special">></span> <span class="special">&,</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T4</span> <span class="special">></span> <span class="special">&);</span>
-
-<span class="keyword">template</span><span class="special"><</span> <span class="keyword">typename</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T3</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T4</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T5</span> <span class="special">></span>
-<span class="keyword">void</span> <span class="identifier">wait_for_any</span><span class="special">(</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T1</span> <span class="special">></span> <span class="special">&,</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T2</span> <span class="special">></span> <span class="special">&,</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T3</span> <span class="special">></span> <span class="special">&,</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T4</span> <span class="special">></span> <span class="special">&,</span> <span class="identifier">task</span><span class="special"><</span> <span class="identifier">T5</span> <span class="special">></span> <span class="special">&);</span>
-</pre>
-<div class="variablelist">
-<p class="title"><b></b></p>
-<dl>
-<dt><span class="term">Effects:</span></dt>
-<dd><p>
- Waits until at leaste one of specified tasks is ready.
- </p></dd>
-<dt><span class="term">Throws:</span></dt>
-<dd><p>
- Any exceptions that might be thrown by the actions.
- </p></dd>
-</dl>
-</div>
</div>
<div class="section" lang="en">
<div class="titlepage"><div><div><h3 class="title">
@@ -1118,7 +895,10 @@
<pre class="programlisting"> <span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">tp</span><span class="special">/</span><span class="identifier">pool</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
<span class="keyword">template</span><span class="special"><</span> <span class="keyword">typename</span> <span class="identifier">Pool</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">R</span> <span class="special">></span>
-<span class="keyword">void</span> <span class="identifier">reschedule_until</span><span class="special">(</span> <span class="identifier">jss</span><span class="special">::</span><span class="identifier">future</span><span class="special"><</span> <span class="identifier">R</span> <span class="special">></span> <span class="keyword">const</span><span class="special">&);</span>
+<span class="keyword">void</span> <span class="identifier">reschedule_until</span><span class="special">(</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">unique_future</span><span class="special"><</span> <span class="identifier">R</span> <span class="special">></span> <span class="keyword">const</span><span class="special">&);</span>
+
+<span class="keyword">template</span><span class="special"><</span> <span class="keyword">typename</span> <span class="identifier">Pool</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">R</span> <span class="special">></span>
+<span class="keyword">void</span> <span class="identifier">reschedule_until</span><span class="special">(</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">shared_future</span><span class="special"><</span> <span class="identifier">R</span> <span class="special">></span> <span class="keyword">const</span><span class="special">&);</span>
</pre>
<div class="variablelist">
<p class="title"><b></b></p>
Modified: sandbox/threadpool/libs/tp/doc/html/boost_threadpool/scheduling.html
==============================================================================
--- sandbox/threadpool/libs/tp/doc/html/boost_threadpool/scheduling.html (original)
+++ sandbox/threadpool/libs/tp/doc/html/boost_threadpool/scheduling.html 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -30,7 +30,7 @@
The scheduling policy determines how actions are scheduled inside the <a class="link" href="channel.html" title="Channel"><span class="emphasis"><em>channel</em></span></a>.
</p>
<a name="boost_threadpool.scheduling.fifo"></a><h4>
-<a name="id372347"></a>
+<a name="id372290"></a>
<a class="link" href="scheduling.html#boost_threadpool.scheduling.fifo">fifo</a>
</h4>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">fifo</span>
@@ -39,7 +39,7 @@
First inserted pending action get taken first.
</p>
<a name="boost_threadpool.scheduling.lifo"></a><h4>
-<a name="id372380"></a>
+<a name="id372323"></a>
<a class="link" href="scheduling.html#boost_threadpool.scheduling.lifo">lifo</a>
</h4>
<pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">lifo</span>
@@ -48,7 +48,7 @@
Last inserted pending action get taken first.
</p>
<a name="boost_threadpool.scheduling.priority"></a><h4>
-<a name="id372412"></a>
+<a name="id372356"></a>
<a class="link" href="scheduling.html#boost_threadpool.scheduling.priority">priority</a>
</h4>
<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span> <span class="keyword">typename</span> <span class="identifier">Attr</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Ord</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">less</span><span class="special"><</span> <span class="identifier">Attr</span> <span class="special">></span> <span class="special">></span> <span class="keyword">struct</span> <span class="identifier">priority</span>
@@ -58,7 +58,7 @@
ordering actions.
</p>
<a name="boost_threadpool.scheduling.smart"></a><h4>
-<a name="id372518"></a>
+<a name="id372462"></a>
<a class="link" href="scheduling.html#boost_threadpool.scheduling.smart">smart</a>
</h4>
<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span> <span class="keyword">typename</span> <span class="identifier">Attr</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Ord</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Enq</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Deq</span> <span class="special">></span> <span class="keyword">struct</span> <span class="identifier">smart</span>
Modified: sandbox/threadpool/libs/tp/doc/html/boost_threadpool/task.html
==============================================================================
--- sandbox/threadpool/libs/tp/doc/html/boost_threadpool/task.html (original)
+++ sandbox/threadpool/libs/tp/doc/html/boost_threadpool/task.html 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -45,10 +45,10 @@
<span class="identifier">fibonacci_fn</span><span class="special">,</span>
<span class="number">10</span><span class="special">)</span> <span class="special">)</span> <span class="special">);</span>
-<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">t</span><span class="special">.</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// 55
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">t</span><span class="special">.</span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// 55
</span></pre>
<a name="boost_threadpool.task.interruption"></a><h4>
-<a name="id370001"></a>
+<a name="id370026"></a>
<a class="link" href="task.html#boost_threadpool.task.interruption">Interruption</a>
</h4>
<p>
@@ -97,7 +97,7 @@
</span><span class="identifier">t</span><span class="special">.</span><span class="identifier">interrupt</span><span class="special">();</span>
<span class="comment">// throws boost::thread_interrupted exception
-</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">t</span><span class="special">.</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">t</span><span class="special">.</span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
</pre>
<p>
</p>
@@ -115,20 +115,10 @@
</span><span class="identifier">t</span><span class="special">.</span><span class="identifier">interrupt_and_wait</span><span class="special">();</span>
<span class="comment">// throws boost::thread_interrupted exception
-</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">t</span><span class="special">.</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">t</span><span class="special">.</span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
</pre>
-<a name="boost_threadpool.task.waiting_for_multiple_tasks"></a><h4>
-<a name="id371039"></a>
- <a class="link" href="task.html#boost_threadpool.task.waiting_for_multiple_tasks">Waiting for
- multiple tasks</a>
- </h4>
-<p>
- It is possible to wait for multiple tasks - <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">tp</span><span class="special">::</span><span class="identifier">wait_for_all</span><span class="special">(</span><span class="identifier">tsk1</span><span class="special">,...,</span><span class="identifier">tskn</span><span class="special">)</span></code> blocks
- until all n tasks are ready and <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">tp</span><span class="special">::</span><span class="identifier">wait_for_any</span><span class="special">(</span><span class="identifier">tsk1</span><span class="special">,...,</span><span class="identifier">tskn</span><span class="special">)</span></code> blocks
- until at least one of the tasks becomes ready.
- </p>
<a name="boost_threadpool.task.exceptions_in_tasks"></a><h4>
-<a name="id371148"></a>
+<a name="id371080"></a>
<a class="link" href="task.html#boost_threadpool.task.exceptions_in_tasks">Exceptions in tasks</a>
</h4>
<p>
@@ -176,7 +166,7 @@
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">bind</span><span class="special">(</span>
<span class="identifier">throwing_fn</span><span class="special">)</span> <span class="special">)</span> <span class="special">);</span>
-<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">t</span><span class="special">.</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// will rethrow an std::runtime_error
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">t</span><span class="special">.</span><span class="identifier">result</span><span class="special">().</span><span class="identifier">get</span><span class="special">()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// will rethrow an std::runtime_error
</span></pre>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
Modified: sandbox/threadpool/libs/tp/doc/html/boost_threadpool/this_task.html
==============================================================================
--- sandbox/threadpool/libs/tp/doc/html/boost_threadpool/this_task.html (original)
+++ sandbox/threadpool/libs/tp/doc/html/boost_threadpool/this_task.html 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -28,12 +28,13 @@
</h2></div></div></div>
<p>
In the function <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">this_task</span><span class="special">::</span><span class="identifier">reschedule_until</span><span class="special">(</span>
- <span class="identifier">jss</span><span class="special">::</span><span class="identifier">future</span><span class="special"><</span> <span class="identifier">R</span> <span class="special">></span> <span class="keyword">const</span><span class="special">&)</span></code> allows to synchronize the task with other
- asynchronous events without blocking the worker threads. The current task will
- be rescheduled until the passed future becomes ready. The pool can be accessed
- via <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">this_task</span><span class="special">::</span><span class="identifier">get_thread_pool</span><span class="special"><</span>
- <span class="identifier">Pool</span> <span class="special">>()</span></code>
- if the calling code is executed by a worker thread.
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">shared_future</span><span class="special"><</span>
+ <span class="identifier">R</span> <span class="special">></span>
+ <span class="keyword">const</span><span class="special">&)</span></code>
+ allows to synchronize the task with other asynchronous events without blocking
+ the worker threads. The current task will be rescheduled until the passed future
+ becomes ready. The pool can be accessed via <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">this_task</span><span class="special">::</span><span class="identifier">get_thread_pool</span><span class="special"><</span> <span class="identifier">Pool</span> <span class="special">>()</span></code> if the calling code is executed by a
+ worker thread.
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
Modified: sandbox/threadpool/libs/tp/doc/html/index.html
==============================================================================
--- sandbox/threadpool/libs/tp/doc/html/index.html (original)
+++ sandbox/threadpool/libs/tp/doc/html/index.html 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -48,10 +48,6 @@
<dd><dl>
<dt><span class="section"> Class template pool
</span></dt>
<dt><span class="section"> Class template task
</span></dt>
-<dt><span class="section"><a href="boost_threadpool/reference.html#boost_threadpool.reference.wait_for_all"> Non-member
- function <code class="computeroutput"><span class="identifier">wait_for_all</span></code></a></span></dt>
-<dt><span class="section"><a href="boost_threadpool/reference.html#boost_threadpool.reference.wait_for_any"> Non-member
- function <code class="computeroutput"><span class="identifier">wait_for_any</span></code></a></span></dt>
<dt><span class="section"><a href="boost_threadpool/reference.html#boost_threadpool.reference.reschedule_until"> Non-member
function <code class="computeroutput"><span class="identifier">reschedule_until</span></code></a></span></dt>
<dt><span class="section"><a href="boost_threadpool/reference.html#boost_threadpool.reference.get_thread_pool"> Non-member
@@ -113,9 +109,8 @@
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
- <span class="bold"><strong>Boost.Threadpool</strong></span> uses the futures library,
- N2561 C++0x proposal, from Anthony Williams (http://www.justsoftwaresolutions.co.uk/threading/updated-implementation-of-c++-futures-3.html)
- as an implementation detail until boost has an official future library.
+ <span class="bold"><strong>Boost.Threadpool</strong></span> uses a modified version
+ of the futures library, N2561 C++0x proposal, from Anthony Williams (http://www.justsoftwaresolutions.co.uk/threading/updated-implementation-of-c++-futures-3.html).
</p></td></tr>
</table></div>
<a name="boost_threadpool.introduction.tested_platforms"></a><h4>
@@ -146,7 +141,7 @@
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: March 01, 2009 at 08:18:32 GMT</small></p></td>
+<td align="left"><p><small>Last revised: March 02, 2009 at 20:05:56 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
Modified: sandbox/threadpool/libs/tp/doc/introduction.qbk
==============================================================================
--- sandbox/threadpool/libs/tp/doc/introduction.qbk (original)
+++ sandbox/threadpool/libs/tp/doc/introduction.qbk 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -19,8 +19,7 @@
which includes all the other headers in turn.
[note
-__boost_threadpool__ uses the futures library, N2561 C++0x proposal, from Anthony Williams ([@http://www.justsoftwaresolutions.co.uk/threading/updated-implementation-of-c++-futures-3.html]) as an implementation detail until boost has
-an official future library.]
+__boost_threadpool__ uses a modified version of the futures library, N2561 C++0x proposal, from Anthony Williams ([@http://www.justsoftwaresolutions.co.uk/threading/updated-implementation-of-c++-futures-3.html]).]
[heading Tested Platforms]
__boost_threadpool__ has been tested on the following compilers/platforms:
Modified: sandbox/threadpool/libs/tp/doc/pool.qbk
==============================================================================
--- sandbox/threadpool/libs/tp/doc/pool.qbk (original)
+++ sandbox/threadpool/libs/tp/doc/pool.qbk 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -78,8 +78,8 @@
pool.shutdown();
- std::cout << t1.get() << std::endl; // 55
- std::cout << t2.get() << std::endl; // 55
+ std::cout << t1.result().get() << std::endl; // 55
+ std::cout << t2.result().get() << std::endl; // 55
[heading Shutdown immediatly]
The function `boost::tp::pool< Channel >::shutdown_now()` sets the pool status to ['terminating] interrupts and then joins all __worker_threads__. After the __worker_threads__ are joined the status of the pool is set to ['terminated] and all pending (unprocessed) __actions__ will be returned.
@@ -112,3 +112,4 @@
The code above will create a pool with two __worker_threads__ on a dual core system (each bound to one core).
[endsect]
+
Modified: sandbox/threadpool/libs/tp/doc/reference.qbk
==============================================================================
--- sandbox/threadpool/libs/tp/doc/reference.qbk (original)
+++ sandbox/threadpool/libs/tp/doc/reference.qbk 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -9,7 +9,6 @@
[include pool_ref.qbk]
[include task_ref.qbk]
-[include wait_ref.qbk]
[include this_task_ref.qbk]
[include poolsize_ref.qbk]
[include scanns_ref.qbk]
Modified: sandbox/threadpool/libs/tp/doc/task.qbk
==============================================================================
--- sandbox/threadpool/libs/tp/doc/task.qbk (original)
+++ sandbox/threadpool/libs/tp/doc/task.qbk 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -21,7 +21,7 @@
fibonacci_fn,
10) ) );
- std::cout << t.get() << std::endl; // 55
+ std::cout << t.result().get() << std::endl; // 55
[heading Interruption]
@@ -57,7 +57,7 @@
t.interrupt();
// throws boost::thread_interrupted exception
- std::cout << t.get() << std::endl;
+ std::cout << t.result().get() << std::endl;
``
boost::tp::pool<
@@ -74,11 +74,7 @@
t.interrupt_and_wait();
// throws boost::thread_interrupted exception
- std::cout << t.get() << std::endl;
-
-[heading Waiting for multiple tasks]
-It is possible to wait for multiple tasks - `boost::tp::wait_for_all(tsk1,...,tskn)` blocks until all n tasks are ready and
-`boost::tp::wait_for_any(tsk1,...,tskn)` blocks until at least one of the tasks becomes ready.
+ std::cout << t.result().get() << std::endl;
[heading Exceptions in tasks]
Exceptions thrown inside an __action__ are transported by the associated task object.
@@ -121,6 +117,6 @@
boost::bind(
throwing_fn) ) );
- std::cout << t.get() << std::endl; // will rethrow an std::runtime_error
+ std::cout << t.result().get() << std::endl; // will rethrow an std::runtime_error
[endsect]
Modified: sandbox/threadpool/libs/tp/doc/task_ref.qbk
==============================================================================
--- sandbox/threadpool/libs/tp/doc/task_ref.qbk (original)
+++ sandbox/threadpool/libs/tp/doc/task_ref.qbk 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -16,7 +16,7 @@
template< typename Pool >
task(
Pool * pool,
- future< R > const& fut,
+ shared_future< R > const& fut,
detail::interrupter const& intr);
void interrupt();
@@ -26,16 +26,7 @@
void interrupt_and_wait( Duration const& rel_time);
bool interrupt_requested();
- R get() const;
-
- bool is_ready() const;
- bool has_value() const;
- bool has_exception() const;
-
- void wait() const;
- template< typename Duration >
- bool timed_wait( Duration const& rel_time) const;
- bool timed_wait_until( system_time const& abs_time) const;
+ shared_future< R > result() const;
};
[section:constructor Constructor]
@@ -43,7 +34,7 @@
template< typename Pool >
task(
Pool * pool,
- future< R > const& fut,
+ shared_future< R > const& fut,
detail::interrupter const& intr);
[variablelist
@@ -81,82 +72,15 @@
[endsect]
-[section:get Member function `get()`]
+[section:result Member function `result()`]
- R get() const;
+ shared_future< R > result() const;
[variablelist
-[[Effects:] [Returns fulfilled value or throws fulfilled exception.]]
+[[Effects:] [Returns fulfilled value or throws fulfilled exception via a shared_future.]]
[[Throws:] [`boost::future::broken_promise`]]
]
[endsect]
-[section:is_read Member function `is_ready()`]
-
- bool is_ready() const;
-
-[variablelist
-[[Effects:] [Queries if the __action__ has been fulfilled.]]
-[[Throws:] [Nothing]]
-]
-[endsect]
-
-
-[section:has_value Member function `has_value()`]
-
- bool has_value() const;
-
-[variablelist
-[[Effects:] [Queries if the __action__ has been fulfilled (is ready) and has a value.]]
-[[Throws:] [Nothing]]
-]
-[endsect]
-
-
-[section:has_exception Member function `has_exception()`]
-
- bool has_exception() const;
-
-[variablelist
-[[Effects:] [Queries if the __action__ has been fulfilled (is ready) and has an exception.]]
-[[Throws:] [Nothing]]
-]
-[endsect]
-
-
-[section:wait Member function `wait()`]
-
- void wait() const;
-
-[variablelist
-[[Effects:] [Waits until the result is ready.]]
-[[Throws:] [Throws thread_interrupted if the result is not ready at the point of the call, and the current thread is interrupted.]]
-]
-[endsect]
-
-
-[section:timed_wait Member function `timed_wait()`]
-
- template< typename Duration >
- bool timed_wait( Duration const& wait_duration);
-
-[variablelist
-[[Effects:] [Waits until the result is ready, or returns false if the time specified by wait_duration has elapsed.]]
-[[Throws:] [Throws thread_interrupted if the result is not ready at the point of the call, and the current thread is interrupted.]]
-]
-[endsect]
-
-
-[section:timed_wait_until Member function `timed_wait_until()`]
-
- bool timed_wait_until( system_time const& wait_timeout);
-
-[variablelist
-[[Effects:] [Waits until the result is ready, or returns false if the time point specified by wait_timeout has passed.]]
-[[Throws:] [Throws thread_interrupted if the result is not ready at the point of the call, and the current thread is interrupted.]]
-]
-[endsect]
-
-
[endsect]
Modified: sandbox/threadpool/libs/tp/doc/this_task.qbk
==============================================================================
--- sandbox/threadpool/libs/tp/doc/this_task.qbk (original)
+++ sandbox/threadpool/libs/tp/doc/this_task.qbk 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -6,7 +6,7 @@
]
[section:this_task Namespace this_task]
-In the function `boost::this_task::reschedule_until( jss::future< R > const&)` allows to synchronize the task with other
+In the function `boost::this_task::reschedule_until( boost::shared_future< R > const&)` allows to synchronize the task with other
asynchronous events without blocking the __worker_threads__. The current task will be rescheduled until the passed future
becomes ready.
The pool can be accessed via `boost::this_task::get_thread_pool< Pool >()` if the calling code is executed by a __worker_thread__.
Modified: sandbox/threadpool/libs/tp/doc/this_task_ref.qbk
==============================================================================
--- sandbox/threadpool/libs/tp/doc/this_task_ref.qbk (original)
+++ sandbox/threadpool/libs/tp/doc/this_task_ref.qbk 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -10,7 +10,10 @@
#include <boost/tp/pool.hpp>
template< typename Pool, typename R >
- void reschedule_until( jss::future< R > const&);
+ void reschedule_until( boost::unique_future< R > const&);
+
+ template< typename Pool, typename R >
+ void reschedule_until( boost::shared_future< R > const&);
[variablelist
[[Effects:] [Reschedules current task until passed future becomes ready.]
Modified: sandbox/threadpool/libs/tp/doc/threadpool.xml
Deleted: sandbox/threadpool/libs/tp/doc/wait_ref.qbk
Modified: sandbox/threadpool/libs/tp/examples/fork_join.cpp
Modified: sandbox/threadpool/libs/tp/examples/interrupt.cpp
Modified: sandbox/threadpool/libs/tp/examples/pending.cpp
Added: sandbox/threadpool/libs/tp/examples/reschedule_until.cpp
Modified: sandbox/threadpool/libs/tp/examples/shutdonw_now.cpp
Modified: sandbox/threadpool/libs/tp/examples/spread_over_hardware.cpp
Modified: sandbox/threadpool/libs/tp/examples/submit.cpp
Modified: sandbox/threadpool/libs/tp/test/test_bounded_queue_fifo.cpp
Modified: sandbox/threadpool/libs/tp/test/test_bounded_queue_lifo.cpp
Modified: sandbox/threadpool/libs/tp/test/test_bounded_queue_priority.cpp
Modified: sandbox/threadpool/libs/tp/test/test_bounded_queue_smart.cpp
Modified: sandbox/threadpool/libs/tp/test/test_unbounded_queue_fifo.cpp
Modified: sandbox/threadpool/libs/tp/test/test_unbounded_queue_lifo.cpp
Modified: sandbox/threadpool/libs/tp/test/test_unbounded_queue_priority.cpp
Modified: sandbox/threadpool/libs/tp/test/test_unbounded_queue_smart.cpp
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
==============================================================================
--- sandbox/threadpool/libs/tp/doc/threadpool.xml (original)
+++ sandbox/threadpool/libs/tp/doc/threadpool.xml 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd">
<library id="boost_threadpool" name="Boost.Threadpool" dirname="boost_threadpool"
-last-revision="$Date: 2009/03/01 08:18:28 $" xmlns:xi="http://www.w3.org/2001/XInclude">
+last-revision="$Date: 2009/03/02 20:05:53 $" xmlns:xi="http://www.w3.org/2001/XInclude">
<libraryinfo>
<authorgroup>
<author>
@@ -56,9 +56,9 @@
</para>
<note>
<para>
- <emphasis role="bold">Boost.Threadpool</emphasis> uses the futures library,
- N2561 C++0x proposal, from Anthony Williams (<ulink url="http://www.justsoftwaresolutions.co.uk/threading/updated-implementation-of-c++-futures-3.html">http://www.justsoftwaresolutions.co.uk/threading/updated-implementation-of-c++-futures-3.html>)
- as an implementation detail until boost has an official future library.
+ <emphasis role="bold">Boost.Threadpool</emphasis> uses a modified version
+ of the futures library, N2561 C++0x proposal, from Anthony Williams (<ulink
+ url="http://www.justsoftwaresolutions.co.uk/threading/updated-implementation-of-c++-futures-3.html">http://www.justsoftwaresolutions.co.uk/threading/updated-implementation-of-c++-futures-3.html>).
</para>
</note>
<anchor id="boost_threadpool.introduction.tested_platforms"/>
@@ -262,8 +262,8 @@
<phrase role="identifier">pool</phrase><phrase role="special">.</phrase><phrase role="identifier">shutdown</phrase><phrase role="special">();</phrase>
-<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">t1</phrase><phrase role="special">.</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase> <phrase role="comment">// 55
-</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">t2</phrase><phrase role="special">.</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase> <phrase role="comment">// 55
+<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">t1</phrase><phrase role="special">.</phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase> <phrase role="comment">// 55
+</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">t2</phrase><phrase role="special">.</phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase> <phrase role="comment">// 55
</phrase></programlisting>
<anchor id="boost_threadpool.pool.shutdown_immediatly"/>
<bridgehead renderas="sect3">
@@ -365,7 +365,7 @@
<phrase role="identifier">fibonacci_fn</phrase><phrase role="special">,</phrase>
<phrase role="number">10</phrase><phrase role="special">)</phrase> <phrase role="special">)</phrase> <phrase role="special">);</phrase>
-<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">t</phrase><phrase role="special">.</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase> <phrase role="comment">// 55
+<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">t</phrase><phrase role="special">.</phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase> <phrase role="comment">// 55
</phrase></programlisting>
<anchor id="boost_threadpool.task.interruption"/>
<bridgehead renderas="sect3">
@@ -451,7 +451,7 @@
</phrase><phrase role="identifier">t</phrase><phrase role="special">.</phrase><phrase role="identifier">interrupt</phrase><phrase role="special">();</phrase>
<phrase role="comment">// throws boost::thread_interrupted exception
-</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">t</phrase><phrase role="special">.</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
+</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">t</phrase><phrase role="special">.</phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
</programlisting>
</para>
@@ -469,26 +469,8 @@
</phrase><phrase role="identifier">t</phrase><phrase role="special">.</phrase><phrase role="identifier">interrupt_and_wait</phrase><phrase role="special">();</phrase>
<phrase role="comment">// throws boost::thread_interrupted exception
-</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">t</phrase><phrase role="special">.</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
+</phrase><phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">t</phrase><phrase role="special">.</phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
</programlisting>
- <anchor id="boost_threadpool.task.waiting_for_multiple_tasks"/>
- <bridgehead renderas="sect3">
- <link linkend="boost_threadpool.task.waiting_for_multiple_tasks">Waiting for
- multiple tasks</link>
- </bridgehead>
- <para>
- It is possible to wait for multiple tasks - <code><phrase role="identifier">boost</phrase><phrase
- role="special">::</phrase><phrase role="identifier">tp</phrase><phrase role="special">::</phrase><phrase
- role="identifier">wait_for_all</phrase><phrase role="special">(</phrase><phrase
- role="identifier">tsk1</phrase><phrase role="special">,...,</phrase><phrase
- role="identifier">tskn</phrase><phrase role="special">)</phrase></code> blocks
- until all n tasks are ready and <code><phrase role="identifier">boost</phrase><phrase
- role="special">::</phrase><phrase role="identifier">tp</phrase><phrase role="special">::</phrase><phrase
- role="identifier">wait_for_any</phrase><phrase role="special">(</phrase><phrase
- role="identifier">tsk1</phrase><phrase role="special">,...,</phrase><phrase
- role="identifier">tskn</phrase><phrase role="special">)</phrase></code> blocks
- until at least one of the tasks becomes ready.
- </para>
<anchor id="boost_threadpool.task.exceptions_in_tasks"/>
<bridgehead renderas="sect3">
<link linkend="boost_threadpool.task.exceptions_in_tasks">Exceptions in tasks</link>
@@ -615,7 +597,7 @@
<phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">bind</phrase><phrase role="special">(</phrase>
<phrase role="identifier">throwing_fn</phrase><phrase role="special">)</phrase> <phrase role="special">)</phrase> <phrase role="special">);</phrase>
-<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">t</phrase><phrase role="special">.</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase> <phrase role="comment">// will rethrow an std::runtime_error
+<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">t</phrase><phrase role="special">.</phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase> <phrase role="comment">// will rethrow an std::runtime_error
</phrase></programlisting>
</section>
<section id="boost_threadpool.this_task">
@@ -624,17 +606,18 @@
In the function <code><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase
role="identifier">this_task</phrase><phrase role="special">::</phrase><phrase
role="identifier">reschedule_until</phrase><phrase role="special">(</phrase>
- <phrase role="identifier">jss</phrase><phrase role="special">::</phrase><phrase
- role="identifier">future</phrase><phrase role="special"><</phrase> <phrase
- role="identifier">R</phrase> <phrase role="special">></phrase> <phrase role="keyword">const</phrase><phrase
- role="special">&)</phrase></code> allows to synchronize the task with other
- asynchronous events without blocking the worker threads. The current task will
- be rescheduled until the passed future becomes ready. The pool can be accessed
- via <code><phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase
- role="identifier">this_task</phrase><phrase role="special">::</phrase><phrase
- role="identifier">get_thread_pool</phrase><phrase role="special"><</phrase>
- <phrase role="identifier">Pool</phrase> <phrase role="special">>()</phrase></code>
- if the calling code is executed by a worker thread.
+ <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase
+ role="identifier">shared_future</phrase><phrase role="special"><</phrase>
+ <phrase role="identifier">R</phrase> <phrase role="special">></phrase>
+ <phrase role="keyword">const</phrase><phrase role="special">&)</phrase></code>
+ allows to synchronize the task with other asynchronous events without blocking
+ the worker threads. The current task will be rescheduled until the passed future
+ becomes ready. The pool can be accessed via <code><phrase role="identifier">boost</phrase><phrase
+ role="special">::</phrase><phrase role="identifier">this_task</phrase><phrase
+ role="special">::</phrase><phrase role="identifier">get_thread_pool</phrase><phrase
+ role="special"><</phrase> <phrase role="identifier">Pool</phrase> <phrase
+ role="special">>()</phrase></code> if the calling code is executed by a
+ worker thread.
</para>
</section>
<section id="boost_threadpool.channel">
@@ -828,7 +811,7 @@
<phrase role="special">&</phrase> <phrase role="identifier">fibo</phrase><phrase role="special">::</phrase><phrase role="identifier">par_</phrase><phrase role="special">,</phrase>
<phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">ref</phrase><phrase role="special">(</phrase> <phrase role="special">*</phrase> <phrase role="keyword">this</phrase><phrase role="special">),</phrase>
<phrase role="identifier">n</phrase> <phrase role="special">-</phrase> <phrase role="number">2</phrase><phrase role="special">)</phrase> <phrase role="special">)</phrase> <phrase role="special">);</phrase>
- <phrase role="keyword">return</phrase> <phrase role="identifier">t1</phrase><phrase role="special">.</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special">+</phrase> <phrase role="identifier">t2</phrase><phrase role="special">.</phrase><phrase role="identifier">get</phrase><phrase role="special">();</phrase>
+ <phrase role="keyword">return</phrase> <phrase role="identifier">t1</phrase><phrase role="special">.</phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special">+</phrase> <phrase role="identifier">t2</phrase><phrase role="special">.</phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">();</phrase>
<phrase role="special">}</phrase>
<phrase role="special">}</phrase>
@@ -869,7 +852,7 @@
<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">vector</phrase><phrase role="special"><</phrase> <phrase role="identifier">tp</phrase><phrase role="special">::</phrase><phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="keyword">int</phrase> <phrase role="special">></phrase> <phrase role="special">>::</phrase><phrase role="identifier">iterator</phrase> <phrase role="identifier">i</phrase><phrase role="special">(</phrase> <phrase role="identifier">results</phrase><phrase role="special">.</phrase><phrase role="identifier">begin</phrase><phrase role="special">()</phrase> <phrase role="special">);</phrase>
<phrase role="identifier">i</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">e</phrase><phrase role="special">;</phrase>
<phrase role="special">++</phrase><phrase role="identifier">i</phrase><phrase role="special">)</phrase>
- <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="string">"fibonacci "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">k</phrase><phrase role="special">++</phrase> <phrase role="special"><<</phrase> <phrase role="string">" == "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">i</phrase><phrase role="special">-></phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
+ <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="string">"fibonacci "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">k</phrase><phrase role="special">++</phrase> <phrase role="special"><<</phrase> <phrase role="string">" == "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">i</phrase><phrase role="special">-></phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
<phrase role="identifier">pt</phrase><phrase role="special">::</phrase><phrase role="identifier">ptime</phrase> <phrase role="identifier">stop</phrase><phrase role="special">(</phrase> <phrase role="identifier">pt</phrase><phrase role="special">::</phrase><phrase role="identifier">microsec_clock</phrase><phrase role="special">::</phrase><phrase role="identifier">universal_time</phrase><phrase role="special">()</phrase> <phrase role="special">);</phrase>
<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="special">(</phrase> <phrase role="identifier">stop</phrase> <phrase role="special">-</phrase> <phrase role="identifier">start</phrase><phrase role="special">).</phrase><phrase role="identifier">total_milliseconds</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="string">" milli seconds"</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
@@ -919,7 +902,7 @@
<phrase role="special">&</phrase> <phrase role="identifier">fibo</phrase><phrase role="special">::</phrase><phrase role="identifier">par_</phrase><phrase role="special">,</phrase>
<phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">ref</phrase><phrase role="special">(</phrase> <phrase role="special">*</phrase> <phrase role="keyword">this</phrase><phrase role="special">),</phrase>
<phrase role="identifier">n</phrase> <phrase role="special">-</phrase> <phrase role="number">2</phrase><phrase role="special">)</phrase> <phrase role="special">)</phrase> <phrase role="special">);</phrase>
- <phrase role="keyword">return</phrase> <phrase role="identifier">t1</phrase><phrase role="special">.</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special">+</phrase> <phrase role="identifier">t2</phrase><phrase role="special">.</phrase><phrase role="identifier">get</phrase><phrase role="special">();</phrase>
+ <phrase role="keyword">return</phrase> <phrase role="identifier">t1</phrase><phrase role="special">.</phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special">+</phrase> <phrase role="identifier">t2</phrase><phrase role="special">.</phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">();</phrase>
<phrase role="special">}</phrase>
<phrase role="special">}</phrase>
@@ -960,7 +943,7 @@
<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">vector</phrase><phrase role="special"><</phrase> <phrase role="identifier">tp</phrase><phrase role="special">::</phrase><phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="keyword">int</phrase> <phrase role="special">></phrase> <phrase role="special">>::</phrase><phrase role="identifier">iterator</phrase> <phrase role="identifier">i</phrase><phrase role="special">(</phrase> <phrase role="identifier">results</phrase><phrase role="special">.</phrase><phrase role="identifier">begin</phrase><phrase role="special">()</phrase> <phrase role="special">);</phrase>
<phrase role="identifier">i</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">e</phrase><phrase role="special">;</phrase>
<phrase role="special">++</phrase><phrase role="identifier">i</phrase><phrase role="special">)</phrase>
- <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="string">"fibonacci "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">k</phrase><phrase role="special">++</phrase> <phrase role="special"><<</phrase> <phrase role="string">" == "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">i</phrase><phrase role="special">-></phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
+ <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="string">"fibonacci "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">k</phrase><phrase role="special">++</phrase> <phrase role="special"><<</phrase> <phrase role="string">" == "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">i</phrase><phrase role="special">-></phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
<phrase role="identifier">pt</phrase><phrase role="special">::</phrase><phrase role="identifier">ptime</phrase> <phrase role="identifier">stop</phrase><phrase role="special">(</phrase> <phrase role="identifier">pt</phrase><phrase role="special">::</phrase><phrase role="identifier">microsec_clock</phrase><phrase role="special">::</phrase><phrase role="identifier">universal_time</phrase><phrase role="special">()</phrase> <phrase role="special">);</phrase>
<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="special">(</phrase> <phrase role="identifier">stop</phrase> <phrase role="special">-</phrase> <phrase role="identifier">start</phrase><phrase role="special">).</phrase><phrase role="identifier">total_milliseconds</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="string">" milli seconds"</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
@@ -1007,7 +990,7 @@
<phrase role="special">&</phrase> <phrase role="identifier">fibo</phrase><phrase role="special">::</phrase><phrase role="identifier">par_</phrase><phrase role="special">,</phrase>
<phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">ref</phrase><phrase role="special">(</phrase> <phrase role="special">*</phrase> <phrase role="keyword">this</phrase><phrase role="special">),</phrase>
<phrase role="identifier">n</phrase> <phrase role="special">-</phrase> <phrase role="number">2</phrase><phrase role="special">)</phrase> <phrase role="special">)</phrase> <phrase role="special">);</phrase>
- <phrase role="keyword">return</phrase> <phrase role="identifier">t1</phrase><phrase role="special">.</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special">+</phrase> <phrase role="identifier">t2</phrase><phrase role="special">.</phrase><phrase role="identifier">get</phrase><phrase role="special">();</phrase>
+ <phrase role="keyword">return</phrase> <phrase role="identifier">t1</phrase><phrase role="special">.</phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special">+</phrase> <phrase role="identifier">t2</phrase><phrase role="special">.</phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">();</phrase>
<phrase role="special">}</phrase>
<phrase role="special">}</phrase>
@@ -1048,7 +1031,7 @@
<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">vector</phrase><phrase role="special"><</phrase> <phrase role="identifier">tp</phrase><phrase role="special">::</phrase><phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="keyword">int</phrase> <phrase role="special">></phrase> <phrase role="special">>::</phrase><phrase role="identifier">iterator</phrase> <phrase role="identifier">i</phrase><phrase role="special">(</phrase> <phrase role="identifier">results</phrase><phrase role="special">.</phrase><phrase role="identifier">begin</phrase><phrase role="special">()</phrase> <phrase role="special">);</phrase>
<phrase role="identifier">i</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">e</phrase><phrase role="special">;</phrase>
<phrase role="special">++</phrase><phrase role="identifier">i</phrase><phrase role="special">)</phrase>
- <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="string">"fibonacci "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">k</phrase><phrase role="special">++</phrase> <phrase role="special"><<</phrase> <phrase role="string">" == "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">i</phrase><phrase role="special">-></phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
+ <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="string">"fibonacci "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">k</phrase><phrase role="special">++</phrase> <phrase role="special"><<</phrase> <phrase role="string">" == "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">i</phrase><phrase role="special">-></phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
<phrase role="identifier">pt</phrase><phrase role="special">::</phrase><phrase role="identifier">ptime</phrase> <phrase role="identifier">stop</phrase><phrase role="special">(</phrase> <phrase role="identifier">pt</phrase><phrase role="special">::</phrase><phrase role="identifier">microsec_clock</phrase><phrase role="special">::</phrase><phrase role="identifier">universal_time</phrase><phrase role="special">()</phrase> <phrase role="special">);</phrase>
<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="special">(</phrase> <phrase role="identifier">stop</phrase> <phrase role="special">-</phrase> <phrase role="identifier">start</phrase><phrase role="special">).</phrase><phrase role="identifier">total_milliseconds</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="string">" milli seconds"</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
@@ -1090,7 +1073,7 @@
<phrase role="special">&</phrase> <phrase role="identifier">fibo</phrase><phrase role="special">::</phrase><phrase role="identifier">par_</phrase><phrase role="special">,</phrase>
<phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">ref</phrase><phrase role="special">(</phrase> <phrase role="special">*</phrase> <phrase role="keyword">this</phrase><phrase role="special">),</phrase>
<phrase role="identifier">n</phrase> <phrase role="special">-</phrase> <phrase role="number">2</phrase><phrase role="special">)</phrase> <phrase role="special">)</phrase> <phrase role="special">);</phrase>
- <phrase role="keyword">return</phrase> <phrase role="identifier">t1</phrase><phrase role="special">.</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special">+</phrase> <phrase role="identifier">t2</phrase><phrase role="special">.</phrase><phrase role="identifier">get</phrase><phrase role="special">();</phrase>
+ <phrase role="keyword">return</phrase> <phrase role="identifier">t1</phrase><phrase role="special">.</phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special">+</phrase> <phrase role="identifier">t2</phrase><phrase role="special">.</phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">();</phrase>
<phrase role="special">}</phrase>
<phrase role="special">}</phrase>
@@ -1131,7 +1114,7 @@
<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">vector</phrase><phrase role="special"><</phrase> <phrase role="identifier">tp</phrase><phrase role="special">::</phrase><phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="keyword">int</phrase> <phrase role="special">></phrase> <phrase role="special">>::</phrase><phrase role="identifier">iterator</phrase> <phrase role="identifier">i</phrase><phrase role="special">(</phrase> <phrase role="identifier">results</phrase><phrase role="special">.</phrase><phrase role="identifier">begin</phrase><phrase role="special">()</phrase> <phrase role="special">);</phrase>
<phrase role="identifier">i</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">e</phrase><phrase role="special">;</phrase>
<phrase role="special">++</phrase><phrase role="identifier">i</phrase><phrase role="special">)</phrase>
- <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="string">"fibonacci "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">k</phrase><phrase role="special">++</phrase> <phrase role="special"><<</phrase> <phrase role="string">" == "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">i</phrase><phrase role="special">-></phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
+ <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="string">"fibonacci "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">k</phrase><phrase role="special">++</phrase> <phrase role="special"><<</phrase> <phrase role="string">" == "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">i</phrase><phrase role="special">-></phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
<phrase role="identifier">pt</phrase><phrase role="special">::</phrase><phrase role="identifier">ptime</phrase> <phrase role="identifier">stop</phrase><phrase role="special">(</phrase> <phrase role="identifier">pt</phrase><phrase role="special">::</phrase><phrase role="identifier">microsec_clock</phrase><phrase role="special">::</phrase><phrase role="identifier">universal_time</phrase><phrase role="special">()</phrase> <phrase role="special">);</phrase>
<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="special">(</phrase> <phrase role="identifier">stop</phrase> <phrase role="special">-</phrase> <phrase role="identifier">start</phrase><phrase role="special">).</phrase><phrase role="identifier">total_milliseconds</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="string">" milli seconds"</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
@@ -1168,7 +1151,7 @@
<phrase role="special">&</phrase> <phrase role="identifier">fibo</phrase><phrase role="special">::</phrase><phrase role="identifier">par_</phrase><phrase role="special">,</phrase>
<phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">ref</phrase><phrase role="special">(</phrase> <phrase role="special">*</phrase> <phrase role="keyword">this</phrase><phrase role="special">),</phrase>
<phrase role="identifier">n</phrase> <phrase role="special">-</phrase> <phrase role="number">2</phrase><phrase role="special">)</phrase> <phrase role="special">)</phrase> <phrase role="special">);</phrase>
- <phrase role="keyword">return</phrase> <phrase role="identifier">t1</phrase><phrase role="special">.</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special">+</phrase> <phrase role="identifier">t2</phrase><phrase role="special">.</phrase><phrase role="identifier">get</phrase><phrase role="special">();</phrase>
+ <phrase role="keyword">return</phrase> <phrase role="identifier">t1</phrase><phrase role="special">.</phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special">+</phrase> <phrase role="identifier">t2</phrase><phrase role="special">.</phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">();</phrase>
<phrase role="special">}</phrase>
<phrase role="special">}</phrase>
@@ -1209,7 +1192,7 @@
<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">vector</phrase><phrase role="special"><</phrase> <phrase role="identifier">tp</phrase><phrase role="special">::</phrase><phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="keyword">int</phrase> <phrase role="special">></phrase> <phrase role="special">>::</phrase><phrase role="identifier">iterator</phrase> <phrase role="identifier">i</phrase><phrase role="special">(</phrase> <phrase role="identifier">results</phrase><phrase role="special">.</phrase><phrase role="identifier">begin</phrase><phrase role="special">()</phrase> <phrase role="special">);</phrase>
<phrase role="identifier">i</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">e</phrase><phrase role="special">;</phrase>
<phrase role="special">++</phrase><phrase role="identifier">i</phrase><phrase role="special">)</phrase>
- <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="string">"fibonacci "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">k</phrase><phrase role="special">++</phrase> <phrase role="special"><<</phrase> <phrase role="string">" == "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">i</phrase><phrase role="special">-></phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
+ <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="string">"fibonacci "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">k</phrase><phrase role="special">++</phrase> <phrase role="special"><<</phrase> <phrase role="string">" == "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">i</phrase><phrase role="special">-></phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
<phrase role="identifier">pt</phrase><phrase role="special">::</phrase><phrase role="identifier">ptime</phrase> <phrase role="identifier">stop</phrase><phrase role="special">(</phrase> <phrase role="identifier">pt</phrase><phrase role="special">::</phrase><phrase role="identifier">microsec_clock</phrase><phrase role="special">::</phrase><phrase role="identifier">universal_time</phrase><phrase role="special">()</phrase> <phrase role="special">);</phrase>
<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="special">(</phrase> <phrase role="identifier">stop</phrase> <phrase role="special">-</phrase> <phrase role="identifier">start</phrase><phrase role="special">).</phrase><phrase role="identifier">total_milliseconds</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="string">" milli seconds"</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
@@ -1230,7 +1213,8 @@
pool<emphasis role="underline">type >().submit( boost::bind( & fibo::par</emphasis>,
boost::ref( * this), n - 1) ) ); tp::task< int > t2( boost::this_task::get_thread_pool<
pool<emphasis role="underline">type >().submit( boost::bind( & fibo::par</emphasis>,
- boost::ref( * this), n - 2) ) ); return t1.get() + t2.get(); } }
+ boost::ref( * this), n - 2) ) ); return t1.result().get() + t2.result().get();
+ } }
</para>
<programlisting><phrase role="keyword">public</phrase><phrase role="special">:</phrase>
@@ -1270,7 +1254,7 @@
<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">vector</phrase><phrase role="special"><</phrase> <phrase role="identifier">tp</phrase><phrase role="special">::</phrase><phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="keyword">int</phrase> <phrase role="special">></phrase> <phrase role="special">>::</phrase><phrase role="identifier">iterator</phrase> <phrase role="identifier">i</phrase><phrase role="special">(</phrase> <phrase role="identifier">results</phrase><phrase role="special">.</phrase><phrase role="identifier">begin</phrase><phrase role="special">()</phrase> <phrase role="special">);</phrase>
<phrase role="identifier">i</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">e</phrase><phrase role="special">;</phrase>
<phrase role="special">++</phrase><phrase role="identifier">i</phrase><phrase role="special">)</phrase>
- <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="string">"fibonacci "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">k</phrase><phrase role="special">++</phrase> <phrase role="special"><<</phrase> <phrase role="string">" == "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">i</phrase><phrase role="special">-></phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
+ <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="string">"fibonacci "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">k</phrase><phrase role="special">++</phrase> <phrase role="special"><<</phrase> <phrase role="string">" == "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">i</phrase><phrase role="special">-></phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
<phrase role="identifier">pt</phrase><phrase role="special">::</phrase><phrase role="identifier">ptime</phrase> <phrase role="identifier">stop</phrase><phrase role="special">(</phrase> <phrase role="identifier">pt</phrase><phrase role="special">::</phrase><phrase role="identifier">microsec_clock</phrase><phrase role="special">::</phrase><phrase role="identifier">universal_time</phrase><phrase role="special">()</phrase> <phrase role="special">);</phrase>
<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="special">(</phrase> <phrase role="identifier">stop</phrase> <phrase role="special">-</phrase> <phrase role="identifier">start</phrase><phrase role="special">).</phrase><phrase role="identifier">total_milliseconds</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="string">" milli seconds"</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
@@ -1321,7 +1305,7 @@
<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">vector</phrase><phrase role="special"><</phrase> <phrase role="identifier">tp</phrase><phrase role="special">::</phrase><phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="keyword">int</phrase> <phrase role="special">></phrase> <phrase role="special">>::</phrase><phrase role="identifier">iterator</phrase> <phrase role="identifier">i</phrase><phrase role="special">(</phrase> <phrase role="identifier">results</phrase><phrase role="special">.</phrase><phrase role="identifier">begin</phrase><phrase role="special">()</phrase> <phrase role="special">);</phrase>
<phrase role="identifier">i</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">e</phrase><phrase role="special">;</phrase>
<phrase role="special">++</phrase><phrase role="identifier">i</phrase><phrase role="special">)</phrase>
- <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="string">"fibonacci "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">k</phrase><phrase role="special">++</phrase> <phrase role="special"><<</phrase> <phrase role="string">" == "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">i</phrase><phrase role="special">-></phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
+ <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="string">"fibonacci "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">k</phrase><phrase role="special">++</phrase> <phrase role="special"><<</phrase> <phrase role="string">" == "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">i</phrase><phrase role="special">-></phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
<phrase role="identifier">pt</phrase><phrase role="special">::</phrase><phrase role="identifier">ptime</phrase> <phrase role="identifier">stop</phrase><phrase role="special">(</phrase> <phrase role="identifier">pt</phrase><phrase role="special">::</phrase><phrase role="identifier">microsec_clock</phrase><phrase role="special">::</phrase><phrase role="identifier">universal_time</phrase><phrase role="special">()</phrase> <phrase role="special">);</phrase>
<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="special">(</phrase> <phrase role="identifier">stop</phrase> <phrase role="special">-</phrase> <phrase role="identifier">start</phrase><phrase role="special">).</phrase><phrase role="identifier">total_milliseconds</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="string">" milli seconds"</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
@@ -1365,7 +1349,7 @@
<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">vector</phrase><phrase role="special"><</phrase> <phrase role="identifier">tp</phrase><phrase role="special">::</phrase><phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="keyword">int</phrase> <phrase role="special">></phrase> <phrase role="special">>::</phrase><phrase role="identifier">iterator</phrase> <phrase role="identifier">i</phrase><phrase role="special">(</phrase> <phrase role="identifier">results</phrase><phrase role="special">.</phrase><phrase role="identifier">begin</phrase><phrase role="special">()</phrase> <phrase role="special">);</phrase>
<phrase role="identifier">i</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">e</phrase><phrase role="special">;</phrase>
<phrase role="special">++</phrase><phrase role="identifier">i</phrase><phrase role="special">)</phrase>
- <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="string">"fibonacci "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">k</phrase><phrase role="special">++</phrase> <phrase role="special"><<</phrase> <phrase role="string">" == "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">i</phrase><phrase role="special">-></phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
+ <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="string">"fibonacci "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">k</phrase><phrase role="special">++</phrase> <phrase role="special"><<</phrase> <phrase role="string">" == "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">i</phrase><phrase role="special">-></phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
<phrase role="identifier">pt</phrase><phrase role="special">::</phrase><phrase role="identifier">ptime</phrase> <phrase role="identifier">stop</phrase><phrase role="special">(</phrase> <phrase role="identifier">pt</phrase><phrase role="special">::</phrase><phrase role="identifier">microsec_clock</phrase><phrase role="special">::</phrase><phrase role="identifier">universal_time</phrase><phrase role="special">()</phrase> <phrase role="special">);</phrase>
<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="special">(</phrase> <phrase role="identifier">stop</phrase> <phrase role="special">-</phrase> <phrase role="identifier">start</phrase><phrase role="special">).</phrase><phrase role="identifier">total_milliseconds</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="string">" milli seconds"</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
@@ -1402,7 +1386,7 @@
<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">vector</phrase><phrase role="special"><</phrase> <phrase role="identifier">tp</phrase><phrase role="special">::</phrase><phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="keyword">int</phrase> <phrase role="special">></phrase> <phrase role="special">>::</phrase><phrase role="identifier">iterator</phrase> <phrase role="identifier">i</phrase><phrase role="special">(</phrase> <phrase role="identifier">results</phrase><phrase role="special">.</phrase><phrase role="identifier">begin</phrase><phrase role="special">()</phrase> <phrase role="special">);</phrase>
<phrase role="identifier">i</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">e</phrase><phrase role="special">;</phrase>
<phrase role="special">++</phrase><phrase role="identifier">i</phrase><phrase role="special">)</phrase>
- <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="string">"fibonacci "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">k</phrase><phrase role="special">++</phrase> <phrase role="special"><<</phrase> <phrase role="string">" == "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">i</phrase><phrase role="special">-></phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
+ <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="string">"fibonacci "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">k</phrase><phrase role="special">++</phrase> <phrase role="special"><<</phrase> <phrase role="string">" == "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">i</phrase><phrase role="special">-></phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
<phrase role="identifier">pt</phrase><phrase role="special">::</phrase><phrase role="identifier">ptime</phrase> <phrase role="identifier">stop</phrase><phrase role="special">(</phrase> <phrase role="identifier">pt</phrase><phrase role="special">::</phrase><phrase role="identifier">microsec_clock</phrase><phrase role="special">::</phrase><phrase role="identifier">universal_time</phrase><phrase role="special">()</phrase> <phrase role="special">);</phrase>
<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="special">(</phrase> <phrase role="identifier">stop</phrase> <phrase role="special">-</phrase> <phrase role="identifier">start</phrase><phrase role="special">).</phrase><phrase role="identifier">total_milliseconds</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="string">" milli seconds"</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
@@ -1435,7 +1419,7 @@
<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">vector</phrase><phrase role="special"><</phrase> <phrase role="identifier">tp</phrase><phrase role="special">::</phrase><phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="keyword">int</phrase> <phrase role="special">></phrase> <phrase role="special">>::</phrase><phrase role="identifier">iterator</phrase> <phrase role="identifier">i</phrase><phrase role="special">(</phrase> <phrase role="identifier">results</phrase><phrase role="special">.</phrase><phrase role="identifier">begin</phrase><phrase role="special">()</phrase> <phrase role="special">);</phrase>
<phrase role="identifier">i</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">e</phrase><phrase role="special">;</phrase>
<phrase role="special">++</phrase><phrase role="identifier">i</phrase><phrase role="special">)</phrase>
- <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="string">"fibonacci "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">k</phrase><phrase role="special">++</phrase> <phrase role="special"><<</phrase> <phrase role="string">" == "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">i</phrase><phrase role="special">-></phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
+ <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="string">"fibonacci "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">k</phrase><phrase role="special">++</phrase> <phrase role="special"><<</phrase> <phrase role="string">" == "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">i</phrase><phrase role="special">-></phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
<phrase role="identifier">pt</phrase><phrase role="special">::</phrase><phrase role="identifier">ptime</phrase> <phrase role="identifier">stop</phrase><phrase role="special">(</phrase> <phrase role="identifier">pt</phrase><phrase role="special">::</phrase><phrase role="identifier">microsec_clock</phrase><phrase role="special">::</phrase><phrase role="identifier">universal_time</phrase><phrase role="special">()</phrase> <phrase role="special">);</phrase>
<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="special">(</phrase> <phrase role="identifier">stop</phrase> <phrase role="special">-</phrase> <phrase role="identifier">start</phrase><phrase role="special">).</phrase><phrase role="identifier">total_milliseconds</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="string">" milli seconds"</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
@@ -1461,7 +1445,7 @@
<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">vector</phrase><phrase role="special"><</phrase> <phrase role="identifier">tp</phrase><phrase role="special">::</phrase><phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="keyword">int</phrase> <phrase role="special">></phrase> <phrase role="special">>::</phrase><phrase role="identifier">iterator</phrase> <phrase role="identifier">i</phrase><phrase role="special">(</phrase> <phrase role="identifier">results</phrase><phrase role="special">.</phrase><phrase role="identifier">begin</phrase><phrase role="special">()</phrase> <phrase role="special">);</phrase>
<phrase role="identifier">i</phrase> <phrase role="special">!=</phrase> <phrase role="identifier">e</phrase><phrase role="special">;</phrase>
<phrase role="special">++</phrase><phrase role="identifier">i</phrase><phrase role="special">)</phrase>
- <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="string">"fibonacci "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">k</phrase><phrase role="special">++</phrase> <phrase role="special"><<</phrase> <phrase role="string">" == "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">i</phrase><phrase role="special">-></phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
+ <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="string">"fibonacci "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">k</phrase><phrase role="special">++</phrase> <phrase role="special"><<</phrase> <phrase role="string">" == "</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">i</phrase><phrase role="special">-></phrase><phrase role="identifier">result</phrase><phrase role="special">().</phrase><phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
<phrase role="identifier">pt</phrase><phrase role="special">::</phrase><phrase role="identifier">ptime</phrase> <phrase role="identifier">stop</phrase><phrase role="special">(</phrase> <phrase role="identifier">pt</phrase><phrase role="special">::</phrase><phrase role="identifier">microsec_clock</phrase><phrase role="special">::</phrase><phrase role="identifier">universal_time</phrase><phrase role="special">()</phrase> <phrase role="special">);</phrase>
<phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">cout</phrase> <phrase role="special"><<</phrase> <phrase role="special">(</phrase> <phrase role="identifier">stop</phrase> <phrase role="special">-</phrase> <phrase role="identifier">start</phrase><phrase role="special">).</phrase><phrase role="identifier">total_milliseconds</phrase><phrase role="special">()</phrase> <phrase role="special"><<</phrase> <phrase role="string">" milli seconds"</phrase> <phrase role="special"><<</phrase> <phrase role="identifier">std</phrase><phrase role="special">::</phrase><phrase role="identifier">endl</phrase><phrase role="special">;</phrase>
@@ -1480,7 +1464,7 @@
int k = 0; std::vector< tp::task< int > >::iterator e( results.end()
); for ( std::vector< tp::task< int > >::iterator i( results.begin()
); i != e; ++i) std::cout << "fibonacci " << k++ <<
- " == " << i->get() << std::endl;
+ " == " << i->result().get() << std::endl;
</para>
<programlisting> <phrase role="identifier">pt</phrase><phrase role="special">::</phrase><phrase role="identifier">ptime</phrase> <phrase role="identifier">stop</phrase><phrase role="special">(</phrase> <phrase role="identifier">pt</phrase><phrase role="special">::</phrase><phrase role="identifier">microsec_clock</phrase><phrase role="special">::</phrase><phrase role="identifier">universal_time</phrase><phrase role="special">()</phrase> <phrase role="special">);</phrase>
@@ -2310,7 +2294,7 @@
<phrase role="keyword">template</phrase><phrase role="special"><</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">Pool</phrase> <phrase role="special">></phrase>
<phrase role="identifier">task</phrase><phrase role="special">(</phrase>
<phrase role="identifier">Pool</phrase> <phrase role="special">*</phrase> <phrase role="identifier">pool</phrase><phrase role="special">,</phrase>
- <phrase role="identifier">future</phrase><phrase role="special"><</phrase> <phrase role="identifier">R</phrase> <phrase role="special">></phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase> <phrase role="identifier">fut</phrase><phrase role="special">,</phrase>
+ <phrase role="identifier">shared_future</phrase><phrase role="special"><</phrase> <phrase role="identifier">R</phrase> <phrase role="special">></phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase> <phrase role="identifier">fut</phrase><phrase role="special">,</phrase>
<phrase role="identifier">detail</phrase><phrase role="special">::</phrase><phrase role="identifier">interrupter</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase> <phrase role="identifier">intr</phrase><phrase role="special">);</phrase>
<phrase role="keyword">void</phrase> <phrase role="identifier">interrupt</phrase><phrase role="special">();</phrase>
@@ -2320,16 +2304,7 @@
<phrase role="keyword">void</phrase> <phrase role="identifier">interrupt_and_wait</phrase><phrase role="special">(</phrase> <phrase role="identifier">Duration</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase> <phrase role="identifier">rel_time</phrase><phrase role="special">);</phrase>
<phrase role="keyword">bool</phrase> <phrase role="identifier">interrupt_requested</phrase><phrase role="special">();</phrase>
- <phrase role="identifier">R</phrase> <phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="keyword">const</phrase><phrase role="special">;</phrase>
-
- <phrase role="keyword">bool</phrase> <phrase role="identifier">is_ready</phrase><phrase role="special">()</phrase> <phrase role="keyword">const</phrase><phrase role="special">;</phrase>
- <phrase role="keyword">bool</phrase> <phrase role="identifier">has_value</phrase><phrase role="special">()</phrase> <phrase role="keyword">const</phrase><phrase role="special">;</phrase>
- <phrase role="keyword">bool</phrase> <phrase role="identifier">has_exception</phrase><phrase role="special">()</phrase> <phrase role="keyword">const</phrase><phrase role="special">;</phrase>
-
- <phrase role="keyword">void</phrase> <phrase role="identifier">wait</phrase><phrase role="special">()</phrase> <phrase role="keyword">const</phrase><phrase role="special">;</phrase>
- <phrase role="keyword">template</phrase><phrase role="special"><</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">Duration</phrase> <phrase role="special">></phrase>
- <phrase role="keyword">bool</phrase> <phrase role="identifier">timed_wait</phrase><phrase role="special">(</phrase> <phrase role="identifier">Duration</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase> <phrase role="identifier">rel_time</phrase><phrase role="special">)</phrase> <phrase role="keyword">const</phrase><phrase role="special">;</phrase>
- <phrase role="keyword">bool</phrase> <phrase role="identifier">timed_wait_until</phrase><phrase role="special">(</phrase> <phrase role="identifier">system_time</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase> <phrase role="identifier">abs_time</phrase><phrase role="special">)</phrase> <phrase role="keyword">const</phrase><phrase role="special">;</phrase>
+ <phrase role="identifier">shared_future</phrase><phrase role="special"><</phrase> <phrase role="identifier">R</phrase> <phrase role="special">></phrase> <phrase role="identifier">result</phrase><phrase role="special">()</phrase> <phrase role="keyword">const</phrase><phrase role="special">;</phrase>
<phrase role="special">};</phrase>
</programlisting>
<section id="boost_threadpool.reference.task.constructor">
@@ -2338,7 +2313,7 @@
<programlisting><phrase role="keyword">template</phrase><phrase role="special"><</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">Pool</phrase> <phrase role="special">></phrase>
<phrase role="identifier">task</phrase><phrase role="special">(</phrase>
<phrase role="identifier">Pool</phrase> <phrase role="special">*</phrase> <phrase role="identifier">pool</phrase><phrase role="special">,</phrase>
- <phrase role="identifier">future</phrase><phrase role="special"><</phrase> <phrase role="identifier">R</phrase> <phrase role="special">></phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase> <phrase role="identifier">fut</phrase><phrase role="special">,</phrase>
+ <phrase role="identifier">shared_future</phrase><phrase role="special"><</phrase> <phrase role="identifier">R</phrase> <phrase role="special">></phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase> <phrase role="identifier">fut</phrase><phrase role="special">,</phrase>
<phrase role="identifier">detail</phrase><phrase role="special">::</phrase><phrase role="identifier">interrupter</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase> <phrase role="identifier">intr</phrase><phrase role="special">);</phrase>
</programlisting>
<variablelist>
@@ -2423,17 +2398,17 @@
</varlistentry>
</variablelist>
</section>
- <section id="boost_threadpool.reference.task.get">
- <title><link linkend="boost_threadpool.reference.task.get"> Member function
- <code><phrase role="identifier">get</phrase><phrase role="special">()</phrase></code></link></title>
+ <section id="boost_threadpool.reference.task.result">
+ <title><link linkend="boost_threadpool.reference.task.result"> Member function
+ <code><phrase role="identifier">result</phrase><phrase role="special">()</phrase></code></link></title>
-<programlisting><phrase role="identifier">R</phrase> <phrase role="identifier">get</phrase><phrase role="special">()</phrase> <phrase role="keyword">const</phrase><phrase role="special">;</phrase>
+<programlisting><phrase role="identifier">shared_future</phrase><phrase role="special"><</phrase> <phrase role="identifier">R</phrase> <phrase role="special">></phrase> <phrase role="identifier">result</phrase><phrase role="special">()</phrase> <phrase role="keyword">const</phrase><phrase role="special">;</phrase>
</programlisting>
<variablelist>
<title></title> <varlistentry><term>Effects:</term>
<listitem>
<para>
- Returns fulfilled value or throws fulfilled exception.
+ Returns fulfilled value or throws fulfilled exception via a shared_future.
</para>
</listitem>
</varlistentry> <varlistentry><term>Throws:</term>
@@ -2447,212 +2422,6 @@
</varlistentry>
</variablelist>
</section>
- <section id="boost_threadpool.reference.task.is_read">
- <title><link linkend="boost_threadpool.reference.task.is_read"> Member function
- <code><phrase role="identifier">is_ready</phrase><phrase role="special">()</phrase></code></link></title>
-
-<programlisting><phrase role="keyword">bool</phrase> <phrase role="identifier">is_ready</phrase><phrase role="special">()</phrase> <phrase role="keyword">const</phrase><phrase role="special">;</phrase>
-</programlisting>
- <variablelist>
- <title></title> <varlistentry><term>Effects:</term>
- <listitem>
- <para>
- Queries if the action has been fulfilled.
- </para>
- </listitem>
- </varlistentry> <varlistentry><term>Throws:</term>
- <listitem>
- <para>
- Nothing
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </section>
- <section id="boost_threadpool.reference.task.has_value">
- <title><link linkend="boost_threadpool.reference.task.has_value"> Member
- function <code><phrase role="identifier">has_value</phrase><phrase role="special">()</phrase></code></link></title>
-
-<programlisting><phrase role="keyword">bool</phrase> <phrase role="identifier">has_value</phrase><phrase role="special">()</phrase> <phrase role="keyword">const</phrase><phrase role="special">;</phrase>
-</programlisting>
- <variablelist>
- <title></title> <varlistentry><term>Effects:</term>
- <listitem>
- <para>
- Queries if the action has been fulfilled (is ready) and has a value.
- </para>
- </listitem>
- </varlistentry> <varlistentry><term>Throws:</term>
- <listitem>
- <para>
- Nothing
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </section>
- <section id="boost_threadpool.reference.task.has_exception">
- <title><link linkend="boost_threadpool.reference.task.has_exception"> Member
- function <code><phrase role="identifier">has_exception</phrase><phrase role="special">()</phrase></code></link></title>
-
-<programlisting><phrase role="keyword">bool</phrase> <phrase role="identifier">has_exception</phrase><phrase role="special">()</phrase> <phrase role="keyword">const</phrase><phrase role="special">;</phrase>
-</programlisting>
- <variablelist>
- <title></title> <varlistentry><term>Effects:</term>
- <listitem>
- <para>
- Queries if the action has been fulfilled (is ready) and has an exception.
- </para>
- </listitem>
- </varlistentry> <varlistentry><term>Throws:</term>
- <listitem>
- <para>
- Nothing
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </section>
- <section id="boost_threadpool.reference.task.wait">
- <title><link linkend="boost_threadpool.reference.task.wait"> Member function
- <code><phrase role="identifier">wait</phrase><phrase role="special">()</phrase></code></link></title>
-
-<programlisting><phrase role="keyword">void</phrase> <phrase role="identifier">wait</phrase><phrase role="special">()</phrase> <phrase role="keyword">const</phrase><phrase role="special">;</phrase>
-</programlisting>
- <variablelist>
- <title></title> <varlistentry><term>Effects:</term>
- <listitem>
- <para>
- Waits until the result is ready.
- </para>
- </listitem>
- </varlistentry> <varlistentry><term>Throws:</term>
- <listitem>
- <para>
- Throws thread_interrupted if the result is not ready at the point of
- the call, and the current thread is interrupted.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </section>
- <section id="boost_threadpool.reference.task.timed_wait">
- <title><link linkend="boost_threadpool.reference.task.timed_wait"> Member
- function <code><phrase role="identifier">timed_wait</phrase><phrase role="special">()</phrase></code></link></title>
-
-<programlisting><phrase role="keyword">template</phrase><phrase role="special"><</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">Duration</phrase> <phrase role="special">></phrase>
-<phrase role="keyword">bool</phrase> <phrase role="identifier">timed_wait</phrase><phrase role="special">(</phrase> <phrase role="identifier">Duration</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase> <phrase role="identifier">wait_duration</phrase><phrase role="special">);</phrase>
-</programlisting>
- <variablelist>
- <title></title> <varlistentry><term>Effects:</term>
- <listitem>
- <para>
- Waits until the result is ready, or returns false if the time specified
- by wait_duration has elapsed.
- </para>
- </listitem>
- </varlistentry> <varlistentry><term>Throws:</term>
- <listitem>
- <para>
- Throws thread_interrupted if the result is not ready at the point of
- the call, and the current thread is interrupted.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </section>
- <section id="boost_threadpool.reference.task.timed_wait_until">
- <title><link linkend="boost_threadpool.reference.task.timed_wait_until">
- Member function <code><phrase role="identifier">timed_wait_until</phrase><phrase
- role="special">()</phrase></code></link></title>
-<programlisting><phrase role="keyword">bool</phrase> <phrase role="identifier">timed_wait_until</phrase><phrase role="special">(</phrase> <phrase role="identifier">system_time</phrase> <phrase role="keyword">const</phrase><phrase role="special">&</phrase> <phrase role="identifier">wait_timeout</phrase><phrase role="special">);</phrase>
-</programlisting>
- <variablelist>
- <title></title> <varlistentry><term>Effects:</term>
- <listitem>
- <para>
- Waits until the result is ready, or returns false if the time point
- specified by wait_timeout has passed.
- </para>
- </listitem>
- </varlistentry> <varlistentry><term>Throws:</term>
- <listitem>
- <para>
- Throws thread_interrupted if the result is not ready at the point of
- the call, and the current thread is interrupted.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </section>
- </section>
- <section id="boost_threadpool.reference.wait_for_all">
- <title><link linkend="boost_threadpool.reference.wait_for_all"> Non-member
- function <code><phrase role="identifier">wait_for_all</phrase></code></link></title>
-
-<programlisting> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">tp</phrase><phrase role="special">/</phrase><phrase role="identifier">task</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase>
-
-<phrase role="keyword">template</phrase><phrase role="special"><</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T2</phrase> <phrase role="special">></phrase>
-<phrase role="keyword">void</phrase> <phrase role="identifier">wait_for_all</phrase><phrase role="special">(</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T1</phrase> <phrase role="special">></phrase> <phrase role="special">&,</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T2</phrase> <phrase role="special">></phrase> <phrase role="special">&);</phrase>
-
-<phrase role="keyword">template</phrase><phrase role="special"><</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T2</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T3</phrase> <phrase role="special">></phrase>
-<phrase role="keyword">void</phrase> <phrase role="identifier">wait_for_all</phrase><phrase role="special">(</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T1</phrase> <phrase role="special">></phrase> <phrase role="special">&,</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T2</phrase> <phrase role="special">></phrase> <phrase role="special">&,</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T3</phrase> <phrase role="special">></phrase> <phrase role="special">&);</phrase>
-
-<phrase role="keyword">template</phrase><phrase role="special"><</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T2</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T3</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T4</phrase> <phrase role="special">></phrase>
-<phrase role="keyword">void</phrase> <phrase role="identifier">wait_for_all</phrase><phrase role="special">(</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T1</phrase> <phrase role="special">></phrase> <phrase role="special">&,</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T2</phrase> <phrase role="special">></phrase> <phrase role="special">&,</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T3</phrase> <phrase role="special">></phrase> <phrase role="special">&,</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T4</phrase> <phrase role="special">></phrase> <phrase role="special">&);</phrase>
-
-<phrase role="keyword">template</phrase><phrase role="special"><</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T2</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T3</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T4</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T5</phrase> <phrase role="special">></phrase>
-<phrase role="keyword">void</phrase> <phrase role="identifier">wait_for_all</phrase><phrase role="special">(</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T1</phrase> <phrase role="special">></phrase> <phrase role="special">&,</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T2</phrase> <phrase role="special">></phrase> <phrase role="special">&,</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T3</phrase> <phrase role="special">></phrase> <phrase role="special">&,</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T4</phrase> <phrase role="special">></phrase> <phrase role="special">&,</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T5</phrase> <phrase role="special">></p
hrase> <phrase role="special">&);</phrase>
-</programlisting>
- <variablelist>
- <title></title> <varlistentry><term>Effects:</term>
- <listitem>
- <para>
- Waits until all specified tasks are ready.
- </para>
- </listitem>
- </varlistentry> <varlistentry><term>Throws:</term>
- <listitem>
- <para>
- Any exceptions that might be thrown by the actions.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
- </section>
- <section id="boost_threadpool.reference.wait_for_any">
- <title><link linkend="boost_threadpool.reference.wait_for_any"> Non-member
- function <code><phrase role="identifier">wait_for_any</phrase></code></link></title>
-
-<programlisting> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">tp</phrase><phrase role="special">/</phrase><phrase role="identifier">task</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase>
-
-<phrase role="keyword">template</phrase><phrase role="special"><</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T2</phrase> <phrase role="special">></phrase>
-<phrase role="keyword">void</phrase> <phrase role="identifier">wait_for_any</phrase><phrase role="special">(</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T1</phrase> <phrase role="special">></phrase> <phrase role="special">&,</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T2</phrase> <phrase role="special">></phrase> <phrase role="special">&);</phrase>
-
-<phrase role="keyword">template</phrase><phrase role="special"><</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T2</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T3</phrase> <phrase role="special">></phrase>
-<phrase role="keyword">void</phrase> <phrase role="identifier">wait_for_any</phrase><phrase role="special">(</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T1</phrase> <phrase role="special">></phrase> <phrase role="special">&,</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T2</phrase> <phrase role="special">></phrase> <phrase role="special">&,</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T3</phrase> <phrase role="special">></phrase> <phrase role="special">&);</phrase>
-
-<phrase role="keyword">template</phrase><phrase role="special"><</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T2</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T3</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T4</phrase> <phrase role="special">></phrase>
-<phrase role="keyword">void</phrase> <phrase role="identifier">wait_for_any</phrase><phrase role="special">(</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T1</phrase> <phrase role="special">></phrase> <phrase role="special">&,</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T2</phrase> <phrase role="special">></phrase> <phrase role="special">&,</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T3</phrase> <phrase role="special">></phrase> <phrase role="special">&,</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T4</phrase> <phrase role="special">></phrase> <phrase role="special">&);</phrase>
-
-<phrase role="keyword">template</phrase><phrase role="special"><</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T1</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T2</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T3</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T4</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">T5</phrase> <phrase role="special">></phrase>
-<phrase role="keyword">void</phrase> <phrase role="identifier">wait_for_any</phrase><phrase role="special">(</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T1</phrase> <phrase role="special">></phrase> <phrase role="special">&,</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T2</phrase> <phrase role="special">></phrase> <phrase role="special">&,</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T3</phrase> <phrase role="special">></phrase> <phrase role="special">&,</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T4</phrase> <phrase role="special">></phrase> <phrase role="special">&,</phrase> <phrase role="identifier">task</phrase><phrase role="special"><</phrase> <phrase role="identifier">T5</phrase> <phrase role="special">></p
hrase> <phrase role="special">&);</phrase>
-</programlisting>
- <variablelist>
- <title></title> <varlistentry><term>Effects:</term>
- <listitem>
- <para>
- Waits until at leaste one of specified tasks is ready.
- </para>
- </listitem>
- </varlistentry> <varlistentry><term>Throws:</term>
- <listitem>
- <para>
- Any exceptions that might be thrown by the actions.
- </para>
- </listitem>
- </varlistentry>
- </variablelist>
</section>
<section id="boost_threadpool.reference.reschedule_until">
<title><link linkend="boost_threadpool.reference.reschedule_until"> Non-member
@@ -2661,7 +2430,10 @@
<programlisting> <phrase role="preprocessor">#include</phrase> <phrase role="special"><</phrase><phrase role="identifier">boost</phrase><phrase role="special">/</phrase><phrase role="identifier">tp</phrase><phrase role="special">/</phrase><phrase role="identifier">pool</phrase><phrase role="special">.</phrase><phrase role="identifier">hpp</phrase><phrase role="special">></phrase>
<phrase role="keyword">template</phrase><phrase role="special"><</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">Pool</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">R</phrase> <phrase role="special">></phrase>
-<phrase role="keyword">void</phrase> <phrase role="identifier">reschedule_until</phrase><phrase role="special">(</phrase> <phrase role="identifier">jss</phrase><phrase role="special">::</phrase><phrase role="identifier">future</phrase><phrase role="special"><</phrase> <phrase role="identifier">R</phrase> <phrase role="special">></phrase> <phrase role="keyword">const</phrase><phrase role="special">&);</phrase>
+<phrase role="keyword">void</phrase> <phrase role="identifier">reschedule_until</phrase><phrase role="special">(</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">unique_future</phrase><phrase role="special"><</phrase> <phrase role="identifier">R</phrase> <phrase role="special">></phrase> <phrase role="keyword">const</phrase><phrase role="special">&);</phrase>
+
+<phrase role="keyword">template</phrase><phrase role="special"><</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">Pool</phrase><phrase role="special">,</phrase> <phrase role="keyword">typename</phrase> <phrase role="identifier">R</phrase> <phrase role="special">></phrase>
+<phrase role="keyword">void</phrase> <phrase role="identifier">reschedule_until</phrase><phrase role="special">(</phrase> <phrase role="identifier">boost</phrase><phrase role="special">::</phrase><phrase role="identifier">shared_future</phrase><phrase role="special"><</phrase> <phrase role="identifier">R</phrase> <phrase role="special">></phrase> <phrase role="keyword">const</phrase><phrase role="special">&);</phrase>
</programlisting>
<variablelist>
<title></title> <varlistentry><term>Effects:</term>
==============================================================================
--- sandbox/threadpool/libs/tp/doc/wait_ref.qbk 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
+++ (empty file)
@@ -1,53 +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:wait_for_all Non-member function `wait_for_all`]
-
- #include <boost/tp/task.hpp>
-
- template< typename T1, typename T2 >
- void wait_for_all( task< T1 > &, task< T2 > &);
-
- template< typename T1, typename T2, typename T3 >
- void wait_for_all( task< T1 > &, task< T2 > &, task< T3 > &);
-
- template< typename T1, typename T2, typename T3, typename T4 >
- void wait_for_all( task< T1 > &, task< T2 > &, task< T3 > &, task< T4 > &);
-
- template< typename T1, typename T2, typename T3, typename T4, typename T5 >
- void wait_for_all( task< T1 > &, task< T2 > &, task< T3 > &, task< T4 > &, task< T5 > &);
-
-[variablelist
-[[Effects:] [Waits until all specified tasks are ready.]]
-[[Throws:] [Any exceptions that might be thrown by the actions.]]
-]
-
-[endsect]
-
-
-[section:wait_for_any Non-member function `wait_for_any`]
-
- #include <boost/tp/task.hpp>
-
- template< typename T1, typename T2 >
- void wait_for_any( task< T1 > &, task< T2 > &);
-
- template< typename T1, typename T2, typename T3 >
- void wait_for_any( task< T1 > &, task< T2 > &, task< T3 > &);
-
- template< typename T1, typename T2, typename T3, typename T4 >
- void wait_for_any( task< T1 > &, task< T2 > &, task< T3 > &, task< T4 > &);
-
- template< typename T1, typename T2, typename T3, typename T4, typename T5 >
- void wait_for_any( task< T1 > &, task< T2 > &, task< T3 > &, task< T4 > &, task< T5 > &);
-
-[variablelist
-[[Effects:] [Waits until at leaste one of specified tasks is ready.]]
-[[Throws:] [Any exceptions that might be thrown by the actions.]]
-]
-
-[endsect]
==============================================================================
--- sandbox/threadpool/libs/tp/examples/fork_join.cpp (original)
+++ sandbox/threadpool/libs/tp/examples/fork_join.cpp 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -44,7 +44,7 @@
& fibo::par_,
boost::ref( * this),
n - 2) ) );
- return t1.get() + t2.get();
+ return t1.result().get() + t2.result().get();
}
}
@@ -85,7 +85,7 @@
std::vector< tp::task< int > >::iterator i( results.begin() );
i != e;
++i)
- std::cout << "fibonacci " << k++ << " == " << i->get() << std::endl;
+ std::cout << "fibonacci " << k++ << " == " << i->result().get() << std::endl;
pt::ptime stop( pt::microsec_clock::universal_time() );
std::cout << ( stop - start).total_milliseconds() << " milli seconds" << std::endl;
==============================================================================
--- sandbox/threadpool/libs/tp/examples/interrupt.cpp (original)
+++ sandbox/threadpool/libs/tp/examples/interrupt.cpp 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -54,7 +54,7 @@
fibonacci_fn,
10) ) );
t.interrupt();
- std::cout << t.get() << std::endl;
+ std::cout << t.result().get() << std::endl;
return EXIT_SUCCESS;
}
==============================================================================
--- sandbox/threadpool/libs/tp/examples/pending.cpp (original)
+++ sandbox/threadpool/libs/tp/examples/pending.cpp 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -52,7 +52,7 @@
fibonacci_fn,
10) ) );
std::cout << "pending tasks == " << pool.pending() << std::endl;
- std::cout << t.get() << std::endl;
+ std::cout << t.result().get() << std::endl;
return EXIT_SUCCESS;
}
==============================================================================
--- (empty file)
+++ sandbox/threadpool/libs/tp/examples/reschedule_until.cpp 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -0,0 +1,119 @@
+#include <iostream>
+#include <cstdlib>
+#include <stdexcept>
+#include <vector>
+
+#include <boost/bind.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/interprocess/sync/interprocess_semaphore.hpp>
+#include <boost/thread.hpp>
+
+#include "boost/tp/fifo.hpp"
+#include "boost/tp/pool.hpp"
+#include "boost/tp/poolsize.hpp"
+#include "boost/tp/unbounded_channel.hpp"
+
+namespace pt = boost::posix_time;
+namespace tp = boost::tp;
+
+typedef tp::pool< tp::unbounded_channel< tp::fifo > > pool_type;
+
+class fibo
+{
+private:
+ jss::shared_future< void > f_;
+ int offset_;
+
+ int seq_( int n)
+ {
+ if ( n <= 1) return n;
+ else return seq_( n - 2) + seq_( n - 1);
+ }
+
+ int par_( int n)
+ {
+ if ( n <= offset_) return seq_( n);
+ else
+ {
+ if ( n == 7)
+ boost::this_task::reschedule_until< pool_type >( f_);
+
+ boost::function< int() > fn1 = boost::bind(
+ & fibo::par_,
+ * this,
+ n - 1);
+ tp::task< int > t1(
+ boost::this_task::get_thread_pool< pool_type >().submit(
+ fn1) );
+ boost::function< int() > fn2 = boost::bind(
+ & fibo::par_,
+ * this,
+ n - 2);
+ tp::task< int > t2(
+ boost::this_task::get_thread_pool< pool_type >().submit(
+ fn2) );
+
+ return t1.get() + t2.get();
+ }
+ }
+
+public:
+ fibo(
+ jss::shared_future< void > f,
+ int offset)
+ : f_( f), offset_( offset)
+ {}
+
+ int execute( int n)
+ {
+ int result( par_( n) );
+ return result;
+ }
+};
+
+void f() {}
+
+int main( int argc, char *argv[])
+{
+ try
+ {
+ pool_type pool( tp::poolsize( 1) );
+ jss::packaged_task< void > tsk( boost::bind( f) );
+ jss::shared_future< void > f( tsk.get_future() );
+ fibo fib( f, 3);
+ std::vector< tp::task< int > > results;
+ results.reserve( 40);
+
+ pt::ptime start( pt::microsec_clock::universal_time() );
+
+ for ( int i = 0; i < 10; ++i)
+ results.push_back(
+ pool.submit(
+ boost::bind(
+ & fibo::execute,
+ boost::ref( fib),
+ i) ) );
+
+ ::sleep( 1);
+ tsk();
+
+ int k = 0;
+ std::vector< tp::task< int > >::iterator e( results.end() );
+ for (
+ std::vector< tp::task< int > >::iterator i( results.begin() );
+ i != e;
+ ++i)
+ std::cout << "fibonacci " << k++ << " == " << i->get() << std::endl;
+
+ pt::ptime stop( pt::microsec_clock::universal_time() );
+ std::cout << ( stop - start).total_milliseconds() << " milli seconds" << std::endl;
+
+ return EXIT_SUCCESS;
+ }
+ catch ( std::exception const& e)
+ { std::cerr << "exception: " << e.what() << std::endl; }
+ catch ( ... )
+ { std::cerr << "unhandled" << std::endl; }
+
+ return EXIT_FAILURE;
+}
==============================================================================
--- sandbox/threadpool/libs/tp/examples/shutdonw_now.cpp (original)
+++ sandbox/threadpool/libs/tp/examples/shutdonw_now.cpp 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -47,7 +47,7 @@
10) ) );
boost::this_thread::sleep( pt::milliseconds( 250) );
pool.shutdown_now();
- std::cout << t.get() << std::endl;
+ std::cout << t.result().get() << std::endl;
return EXIT_SUCCESS;
}
==============================================================================
--- sandbox/threadpool/libs/tp/examples/spread_over_hardware.cpp (original)
+++ sandbox/threadpool/libs/tp/examples/spread_over_hardware.cpp 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -44,7 +44,7 @@
& fibo::par_,
boost::ref( * this),
n - 2) ) );
- return t1.get() + t2.get();
+ return t1.result().get() + t2.result().get();
}
}
@@ -86,7 +86,7 @@
std::vector< tp::task< int > >::iterator i( results.begin() );
i != e;
++i)
- std::cout << "fibonacci " << k++ << " == " << i->get() << std::endl;
+ std::cout << "fibonacci " << k++ << " == " << i->result().get() << std::endl;
pt::ptime stop( pt::microsec_clock::universal_time() );
std::cout << ( stop - start).total_milliseconds() << " milli seconds" << std::endl;
==============================================================================
--- sandbox/threadpool/libs/tp/examples/submit.cpp (original)
+++ sandbox/threadpool/libs/tp/examples/submit.cpp 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -40,7 +40,7 @@
boost::bind(
fibonacci_fn,
10) ) );
- std::cout << t.get() << std::endl;
+ std::cout << t.result().get() << std::endl;
return EXIT_SUCCESS;
}
==============================================================================
--- sandbox/threadpool/libs/tp/test/test_bounded_queue_fifo.cpp (original)
+++ sandbox/threadpool/libs/tp/test/test_bounded_queue_fifo.cpp 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -62,7 +62,7 @@
boost::bind(
fibonacci_fn,
10) ) );
- BOOST_CHECK_EQUAL( t.get(), 55);
+ BOOST_CHECK_EQUAL( t.result().get(), 55);
}
// check shutdown
@@ -81,7 +81,7 @@
10) ) );
pool.shutdown();
BOOST_CHECK( pool.terminated() );
- BOOST_CHECK_EQUAL( t.get(), 55);
+ BOOST_CHECK_EQUAL( t.result().get(), 55);
}
// check runtime_error throw inside task
@@ -100,7 +100,7 @@
pool.shutdown();
bool thrown( false);
try
- { t.get(); }
+ { t.result().get(); }
catch ( std::runtime_error const&)
{ thrown = true; }
BOOST_CHECK( thrown);
@@ -158,7 +158,7 @@
BOOST_CHECK_EQUAL( pool.active(), std::size_t( 0) );
bool thrown( false);
try
- { t.get(); }
+ { t.result().get(); }
catch ( boost::thread_interrupted const&)
{ thrown = true; }
BOOST_CHECK( thrown);
@@ -194,9 +194,9 @@
boost::this_thread::sleep( pt::millisec(250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 2) );
b.wait();
- BOOST_CHECK_EQUAL( t1.get(), 55);
- BOOST_CHECK_EQUAL( t2.get(), 55);
- BOOST_CHECK_EQUAL( t3.get(), 55);
+ BOOST_CHECK_EQUAL( t1.result().get(), 55);
+ BOOST_CHECK_EQUAL( t2.result().get(), 55);
+ BOOST_CHECK_EQUAL( t3.result().get(), 55);
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 0) );
}
@@ -277,7 +277,7 @@
BOOST_CHECK_EQUAL( buffer.size(), std::size_t( 1) );
bool thrown( false);
try
- { t.get(); }
+ { t.result().get(); }
catch ( boost::thread_interrupted const&)
{ thrown = true; }
BOOST_CHECK( thrown);
==============================================================================
--- sandbox/threadpool/libs/tp/test/test_bounded_queue_lifo.cpp (original)
+++ sandbox/threadpool/libs/tp/test/test_bounded_queue_lifo.cpp 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -57,12 +57,12 @@
tp::poolsize( 1),
tp::high_watermark( 10),
tp::low_watermark( 10) );
- tp::task< int > f(
+ tp::task< int > t(
pool.submit(
boost::bind(
fibonacci_fn,
10) ) );
- BOOST_CHECK_EQUAL( f.get(), 55);
+ BOOST_CHECK_EQUAL( t.result().get(), 55);
}
// check shutdown
@@ -81,7 +81,7 @@
10) ) );
pool.shutdown();
BOOST_CHECK( pool.terminated() );
- BOOST_CHECK_EQUAL( t.get(), 55);
+ BOOST_CHECK_EQUAL( t.result().get(), 55);
}
// check runtime_error throw inside task
@@ -93,14 +93,14 @@
tp::poolsize( 1),
tp::high_watermark( 10),
tp::low_watermark( 10) );
- tp::task< void > f(
+ tp::task< void > t(
pool.submit(
boost::bind(
throwing_fn) ) );
pool.shutdown();
bool thrown( false);
try
- { f.get(); }
+ { t.result().get(); }
catch ( std::runtime_error const&)
{ thrown = true; }
BOOST_CHECK( thrown);
@@ -143,7 +143,7 @@
boost::bind(
fibonacci_fn,
10) );
- tp::task< int > f(
+ tp::task< int > t(
pool.submit(
boost::bind(
( int ( *)( boost::function< int() > const&, pt::time_duration const&) ) delay_fn,
@@ -158,7 +158,7 @@
BOOST_CHECK_EQUAL( pool.active(), std::size_t( 0) );
bool thrown( false);
try
- { f.get(); }
+ { t.result().get(); }
catch ( boost::thread_interrupted const&)
{ thrown = true; }
BOOST_CHECK( thrown);
@@ -179,7 +179,7 @@
boost::bind(
fibonacci_fn,
10) );
- tp::task< int > f1(
+ tp::task< int > t1(
pool.submit(
boost::bind(
( int ( *)( boost::function< int() > const&, boost::barrier &) ) barrier_fn,
@@ -187,16 +187,16 @@
boost::ref( b) ) ) );
boost::this_thread::sleep( pt::millisec( 250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 0) );
- tp::task< int > f2( pool.submit( fn) );
+ tp::task< int > t2( pool.submit( fn) );
boost::this_thread::sleep( pt::millisec(250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 1) );
- tp::task< int > f3( pool.submit( fn) );
+ tp::task< int > t3( pool.submit( fn) );
boost::this_thread::sleep( pt::millisec(250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 2) );
b.wait();
- BOOST_CHECK_EQUAL( f1.get(), 55);
- BOOST_CHECK_EQUAL( f2.get(), 55);
- BOOST_CHECK_EQUAL( f3.get(), 55);
+ BOOST_CHECK_EQUAL( t1.result().get(), 55);
+ BOOST_CHECK_EQUAL( t2.result().get(), 55);
+ BOOST_CHECK_EQUAL( t3.result().get(), 55);
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 0) );
}
@@ -215,12 +215,11 @@
boost::bind(
fibonacci_fn,
10) );
- tp::task< int > f1(
- pool.submit(
- boost::bind(
- ( int ( *)( boost::function< int() > const&, boost::barrier &) ) barrier_fn,
- fn,
- boost::ref( b) ) ) );
+ pool.submit(
+ boost::bind(
+ ( int ( *)( boost::function< int() > const&, boost::barrier &) ) barrier_fn,
+ fn,
+ boost::ref( b) ) );
std::vector< int > buffer;
pool.submit(
boost::bind(
@@ -260,7 +259,7 @@
fn,
boost::ref( b) ) );
std::vector< int > buffer;
- tp::task< void > f(
+ tp::task< void > t(
pool.submit(
boost::bind(
buffer_fibonacci_fn,
@@ -271,14 +270,14 @@
buffer_fibonacci_fn,
boost::ref( buffer),
0) );
- f.interrupt();
+ t.interrupt();
b.wait();
pool.shutdown();
BOOST_CHECK_EQUAL( buffer[0], 0);
BOOST_CHECK_EQUAL( buffer.size(), std::size_t( 1) );
bool thrown( false);
try
- { f.get(); }
+ { t.result().get(); }
catch ( boost::thread_interrupted const&)
{ thrown = true; }
BOOST_CHECK( thrown);
==============================================================================
--- sandbox/threadpool/libs/tp/test/test_bounded_queue_priority.cpp (original)
+++ sandbox/threadpool/libs/tp/test/test_bounded_queue_priority.cpp 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -57,13 +57,13 @@
tp::poolsize( 1),
tp::high_watermark( 10),
tp::low_watermark( 10) );
- tp::task< int > f(
+ tp::task< int > t(
pool.submit(
boost::bind(
fibonacci_fn,
10),
0) );
- BOOST_CHECK_EQUAL( f.get(), 55);
+ BOOST_CHECK_EQUAL( t.result().get(), 55);
}
// check shutdown
@@ -83,7 +83,7 @@
0) );
pool.shutdown();
BOOST_CHECK( pool.terminated() );
- BOOST_CHECK_EQUAL( t.get(), 55);
+ BOOST_CHECK_EQUAL( t.result().get(), 55);
}
// check runtime_error throw inside task
@@ -95,7 +95,7 @@
tp::poolsize( 1),
tp::high_watermark( 10),
tp::low_watermark( 10) );
- tp::task< void > f(
+ tp::task< void > t(
pool.submit(
boost::bind(
throwing_fn),
@@ -103,7 +103,7 @@
pool.shutdown();
bool thrown( false);
try
- { f.get(); }
+ { t.result().get(); }
catch ( std::runtime_error const&)
{ thrown = true; }
BOOST_CHECK( thrown);
@@ -147,7 +147,7 @@
boost::bind(
fibonacci_fn,
10) );
- tp::task< int > f(
+ tp::task< int > t(
pool.submit(
boost::bind(
( int ( *)( boost::function< int() > const&, pt::time_duration const&) ) delay_fn,
@@ -165,7 +165,7 @@
BOOST_CHECK_EQUAL( pool.active(), std::size_t( 0) );
bool thrown( false);
try
- { f.get(); }
+ { t.result().get(); }
catch ( boost::thread_interrupted const&)
{ thrown = true; }
BOOST_CHECK( thrown);
@@ -186,7 +186,7 @@
boost::bind(
fibonacci_fn,
10) );
- tp::task< int > f1(
+ tp::task< int > t1(
pool.submit(
boost::bind(
( int ( *)( boost::function< int() > const&, boost::barrier &) ) barrier_fn,
@@ -195,16 +195,16 @@
0) );
boost::this_thread::sleep( pt::millisec( 250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 0) );
- tp::task< int > f2( pool.submit( fn, 0) );
+ tp::task< int > t2( pool.submit( fn, 0) );
boost::this_thread::sleep( pt::millisec(250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 1) );
- tp::task< int > f3( pool.submit( fn, 0) );
+ tp::task< int > t3( pool.submit( fn, 0) );
boost::this_thread::sleep( pt::millisec(250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 2) );
b.wait();
- BOOST_CHECK_EQUAL( f1.get(), 55);
- BOOST_CHECK_EQUAL( f2.get(), 55);
- BOOST_CHECK_EQUAL( f3.get(), 55);
+ BOOST_CHECK_EQUAL( t1.result().get(), 55);
+ BOOST_CHECK_EQUAL( t2.result().get(), 55);
+ BOOST_CHECK_EQUAL( t3.result().get(), 55);
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 0) );
}
@@ -223,13 +223,12 @@
boost::bind(
fibonacci_fn,
10) );
- tp::task< int > f1(
- pool.submit(
- boost::bind(
- ( int ( *)( boost::function< int() > const&, boost::barrier &) ) barrier_fn,
- fn,
- boost::ref( b) ),
- 0) );
+ pool.submit(
+ boost::bind(
+ ( int ( *)( boost::function< int() > const&, boost::barrier &) ) barrier_fn,
+ fn,
+ boost::ref( b) ),
+ 0);
std::vector< int > buffer;
pool.submit(
boost::bind(
@@ -272,7 +271,7 @@
boost::ref( b) ),
0);
std::vector< int > buffer;
- tp::task< void > f(
+ tp::task< void > t(
pool.submit(
boost::bind(
buffer_fibonacci_fn,
@@ -285,14 +284,14 @@
boost::ref( buffer),
0),
0);
- f.interrupt();
+ t.interrupt();
b.wait();
pool.shutdown();
BOOST_CHECK_EQUAL( buffer[0], 0);
BOOST_CHECK_EQUAL( buffer.size(), std::size_t( 1) );
bool thrown( false);
try
- { f.get(); }
+ { t.result().get(); }
catch ( boost::thread_interrupted const&)
{ thrown = true; }
BOOST_CHECK( thrown);
==============================================================================
--- sandbox/threadpool/libs/tp/test/test_bounded_queue_smart.cpp (original)
+++ sandbox/threadpool/libs/tp/test/test_bounded_queue_smart.cpp 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -57,13 +57,13 @@
tp::poolsize( 1),
tp::high_watermark( 10),
tp::low_watermark( 10) );
- tp::task< int > f(
+ tp::task< int > t(
pool.submit(
boost::bind(
fibonacci_fn,
10),
0) );
- BOOST_CHECK_EQUAL( f.get(), 55);
+ BOOST_CHECK_EQUAL( t.result().get(), 55);
}
// check shutdown
@@ -83,7 +83,7 @@
0) );
pool.shutdown();
BOOST_CHECK( pool.terminated() );
- BOOST_CHECK_EQUAL( t.get(), 55);
+ BOOST_CHECK_EQUAL( t.result().get(), 55);
}
// check runtime_error throw inside task
@@ -95,7 +95,7 @@
tp::poolsize( 1),
tp::high_watermark( 10),
tp::low_watermark( 10) );
- tp::task< void > f(
+ tp::task< void > t(
pool.submit(
boost::bind(
throwing_fn),
@@ -103,7 +103,7 @@
pool.shutdown();
bool thrown( false);
try
- { f.get(); }
+ { t.result().get(); }
catch ( std::runtime_error const&)
{ thrown = true; }
BOOST_CHECK( thrown);
@@ -147,7 +147,7 @@
boost::bind(
fibonacci_fn,
10) );
- tp::task< int > f(
+ tp::task< int > t(
pool.submit(
boost::bind(
( int ( *)( boost::function< int() > const&, pt::time_duration const&) ) delay_fn,
@@ -165,7 +165,7 @@
BOOST_CHECK_EQUAL( pool.active(), std::size_t( 0) );
bool thrown( false);
try
- { f.get(); }
+ { t.result().get(); }
catch ( boost::thread_interrupted const&)
{ thrown = true; }
BOOST_CHECK( thrown);
@@ -186,7 +186,7 @@
boost::bind(
fibonacci_fn,
10) );
- tp::task< int > f1(
+ tp::task< int > t1(
pool.submit(
boost::bind(
( int ( *)( boost::function< int() > const&, boost::barrier &) ) barrier_fn,
@@ -195,16 +195,16 @@
0) );
boost::this_thread::sleep( pt::millisec( 250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 0) );
- tp::task< int > f2( pool.submit( fn, 1) );
+ tp::task< int > t2( pool.submit( fn, 1) );
boost::this_thread::sleep( pt::millisec(250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 1) );
- tp::task< int > f3( pool.submit( fn, 2) );
+ tp::task< int > t3( pool.submit( fn, 2) );
boost::this_thread::sleep( pt::millisec(250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 2) );
b.wait();
- BOOST_CHECK_EQUAL( f1.get(), 55);
- BOOST_CHECK_EQUAL( f2.get(), 55);
- BOOST_CHECK_EQUAL( f3.get(), 55);
+ BOOST_CHECK_EQUAL( t1.result().get(), 55);
+ BOOST_CHECK_EQUAL( t2.result().get(), 55);
+ BOOST_CHECK_EQUAL( t3.result().get(), 55);
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 0) );
}
@@ -223,13 +223,12 @@
boost::bind(
fibonacci_fn,
10) );
- tp::task< int > f1(
- pool.submit(
- boost::bind(
- ( int ( *)( boost::function< int() > const&, boost::barrier &) ) barrier_fn,
- fn,
- boost::ref( b) ),
- 0) );
+ pool.submit(
+ boost::bind(
+ ( int ( *)( boost::function< int() > const&, boost::barrier &) ) barrier_fn,
+ fn,
+ boost::ref( b) ),
+ 0);
std::vector< int > buffer;
pool.submit(
boost::bind(
@@ -278,7 +277,7 @@
boost::ref( b) ),
0);
std::vector< int > buffer;
- tp::task< void > f(
+ tp::task< void > t(
pool.submit(
boost::bind(
buffer_fibonacci_fn,
@@ -291,14 +290,14 @@
boost::ref( buffer),
0),
1);
- f.interrupt();
+ t.interrupt();
b.wait();
pool.shutdown();
BOOST_CHECK_EQUAL( buffer[0], 0);
BOOST_CHECK_EQUAL( buffer.size(), std::size_t( 1) );
bool thrown( false);
try
- { f.get(); }
+ { t.result().get(); }
catch ( boost::thread_interrupted const&)
{ thrown = true; }
BOOST_CHECK( thrown);
==============================================================================
--- sandbox/threadpool/libs/tp/test/test_unbounded_queue_fifo.cpp (original)
+++ sandbox/threadpool/libs/tp/test/test_unbounded_queue_fifo.cpp 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -50,12 +50,12 @@
tp::pool<
tp::unbounded_channel< tp::fifo >
> pool( tp::poolsize( 1) );
- tp::task< int > tsk(
+ tp::task< int > t(
pool.submit(
boost::bind(
fibonacci_fn,
10) ) );
- BOOST_CHECK_EQUAL( tsk.get(), 55);
+ BOOST_CHECK_EQUAL( t.result().get(), 55);
}
// check shutdown
@@ -71,7 +71,7 @@
10) ) );
pool.shutdown();
BOOST_CHECK( pool.terminated() );
- BOOST_CHECK_EQUAL( t.get(), 55);
+ BOOST_CHECK_EQUAL( t.result().get(), 55);
}
// check runtime_error throw inside task
@@ -80,14 +80,14 @@
tp::pool<
tp::unbounded_channel< tp::fifo >
> pool( tp::poolsize( 1) );
- tp::task< void > tsk(
+ tp::task< void > t(
pool.submit(
boost::bind(
throwing_fn) ) );
pool.shutdown();
bool thrown( false);
try
- { tsk.get(); }
+ { t.result().get(); }
catch ( std::runtime_error const&)
{ thrown = true; }
BOOST_CHECK( thrown);
@@ -124,7 +124,7 @@
boost::bind(
fibonacci_fn,
10) );
- tp::task< int > tsk(
+ tp::task< int > t(
pool.submit(
boost::bind(
( int ( *)( boost::function< int() > const&, pt::time_duration const&) ) delay_fn,
@@ -139,7 +139,7 @@
BOOST_CHECK_EQUAL( pool.active(), std::size_t( 0) );
bool thrown( false);
try
- { tsk.get(); }
+ { t.result().get(); }
catch ( boost::thread_interrupted const&)
{ thrown = true; }
BOOST_CHECK( thrown);
@@ -157,7 +157,7 @@
boost::bind(
fibonacci_fn,
10) );
- tp::task< int > tsk1(
+ tp::task< int > t1(
pool.submit(
boost::bind(
( int ( *)( boost::function< int() > const&, boost::barrier &) ) barrier_fn,
@@ -165,16 +165,16 @@
boost::ref( b) ) ) );
boost::this_thread::sleep( pt::millisec( 250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 0) );
- tp::task< int > tsk2( pool.submit( fn) );
+ tp::task< int > t2( pool.submit( fn) );
boost::this_thread::sleep( pt::millisec(250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 1) );
- tp::task< int > tsk3( pool.submit( fn) );
+ tp::task< int > t3( pool.submit( fn) );
boost::this_thread::sleep( pt::millisec(250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 2) );
b.wait();
- BOOST_CHECK_EQUAL( tsk1.get(), 55);
- BOOST_CHECK_EQUAL( tsk2.get(), 55);
- BOOST_CHECK_EQUAL( tsk3.get(), 55);
+ BOOST_CHECK_EQUAL( t1.result().get(), 55);
+ BOOST_CHECK_EQUAL( t2.result().get(), 55);
+ BOOST_CHECK_EQUAL( t3.result().get(), 55);
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 0) );
}
@@ -190,12 +190,11 @@
boost::bind(
fibonacci_fn,
10) );
- tp::task< int > tsk1(
- pool.submit(
- boost::bind(
- ( int ( *)( boost::function< int() > const&, boost::barrier &) ) barrier_fn,
- fn,
- boost::ref( b) ) ) );
+ pool.submit(
+ boost::bind(
+ ( int ( *)( boost::function< int() > const&, boost::barrier &) ) barrier_fn,
+ fn,
+ boost::ref( b) ) );
std::vector< int > buffer;
pool.submit(
boost::bind(
@@ -232,7 +231,7 @@
fn,
boost::ref( b) ) );
std::vector< int > buffer;
- tp::task< void > tsk(
+ tp::task< void > t(
pool.submit(
boost::bind(
buffer_fibonacci_fn,
@@ -243,14 +242,14 @@
buffer_fibonacci_fn,
boost::ref( buffer),
0) );
- tsk.interrupt();
+ t.interrupt();
b.wait();
pool.shutdown();
BOOST_CHECK_EQUAL( buffer[0], 0);
BOOST_CHECK_EQUAL( buffer.size(), std::size_t( 1) );
bool thrown( false);
try
- { tsk.get(); }
+ { t.result().get(); }
catch ( boost::thread_interrupted const&)
{ thrown = true; }
BOOST_CHECK( thrown);
==============================================================================
--- sandbox/threadpool/libs/tp/test/test_unbounded_queue_lifo.cpp (original)
+++ sandbox/threadpool/libs/tp/test/test_unbounded_queue_lifo.cpp 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -50,12 +50,12 @@
tp::pool<
tp::unbounded_channel< tp::lifo >
> pool( tp::poolsize( 1) );
- tp::task< int > tsk(
+ tp::task< int > t(
pool.submit(
boost::bind(
fibonacci_fn,
10) ) );
- BOOST_CHECK_EQUAL( tsk.get(), 55);
+ BOOST_CHECK_EQUAL( t.result().get(), 55);
}
// check shutdown
@@ -71,7 +71,7 @@
10) ) );
pool.shutdown();
BOOST_CHECK( pool.terminated() );
- BOOST_CHECK_EQUAL( t.get(), 55);
+ BOOST_CHECK_EQUAL( t.result().get(), 55);
}
// check runtime_error throw inside task
@@ -80,14 +80,14 @@
tp::pool<
tp::unbounded_channel< tp::lifo >
> pool( tp::poolsize( 1) );
- tp::task< void > tsk(
+ tp::task< void > t(
pool.submit(
boost::bind(
throwing_fn) ) );
pool.shutdown();
bool thrown( false);
try
- { tsk.get(); }
+ { t.result().get(); }
catch ( std::runtime_error const&)
{ thrown = true; }
BOOST_CHECK( thrown);
@@ -124,7 +124,7 @@
boost::bind(
fibonacci_fn,
10) );
- tp::task< int > tsk(
+ tp::task< int > t(
pool.submit(
boost::bind(
( int ( *)( boost::function< int() > const&, pt::time_duration const&) ) delay_fn,
@@ -139,7 +139,7 @@
BOOST_CHECK_EQUAL( pool.active(), std::size_t( 0) );
bool thrown( false);
try
- { tsk.get(); }
+ { t.result().get(); }
catch ( boost::thread_interrupted const&)
{ thrown = true; }
BOOST_CHECK( thrown);
@@ -157,7 +157,7 @@
boost::bind(
fibonacci_fn,
10) );
- tp::task< int > tsk1(
+ tp::task< int > t1(
pool.submit(
boost::bind(
( int ( *)( boost::function< int() > const&, boost::barrier &) ) barrier_fn,
@@ -165,16 +165,16 @@
boost::ref( b) ) ) );
boost::this_thread::sleep( pt::millisec( 250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 0) );
- tp::task< int > tsk2( pool.submit( fn) );
+ tp::task< int > t2( pool.submit( fn) );
boost::this_thread::sleep( pt::millisec(250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 1) );
- tp::task< int > tsk3( pool.submit( fn) );
+ tp::task< int > t3( pool.submit( fn) );
boost::this_thread::sleep( pt::millisec(250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 2) );
b.wait();
- BOOST_CHECK_EQUAL( tsk1.get(), 55);
- BOOST_CHECK_EQUAL( tsk2.get(), 55);
- BOOST_CHECK_EQUAL( tsk3.get(), 55);
+ BOOST_CHECK_EQUAL( t1.result().get(), 55);
+ BOOST_CHECK_EQUAL( t2.result().get(), 55);
+ BOOST_CHECK_EQUAL( t3.result().get(), 55);
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 0) );
}
@@ -190,12 +190,11 @@
boost::bind(
fibonacci_fn,
10) );
- tp::task< int > tsk1(
- pool.submit(
- boost::bind(
- ( int ( *)( boost::function< int() > const&, boost::barrier &) ) barrier_fn,
- fn,
- boost::ref( b) ) ) );
+ pool.submit(
+ boost::bind(
+ ( int ( *)( boost::function< int() > const&, boost::barrier &) ) barrier_fn,
+ fn,
+ boost::ref( b) ) );
std::vector< int > buffer;
pool.submit(
boost::bind(
@@ -232,7 +231,7 @@
fn,
boost::ref( b) ) );
std::vector< int > buffer;
- tp::task< void > tsk(
+ tp::task< void > t(
pool.submit(
boost::bind(
buffer_fibonacci_fn,
@@ -243,14 +242,14 @@
buffer_fibonacci_fn,
boost::ref( buffer),
0) );
- tsk.interrupt();
+ t.interrupt();
b.wait();
pool.shutdown();
BOOST_CHECK_EQUAL( buffer[0], 0);
BOOST_CHECK_EQUAL( buffer.size(), std::size_t( 1) );
bool thrown( false);
try
- { tsk.get(); }
+ { t.result().get(); }
catch ( boost::thread_interrupted const&)
{ thrown = true; }
BOOST_CHECK( thrown);
==============================================================================
--- sandbox/threadpool/libs/tp/test/test_unbounded_queue_priority.cpp (original)
+++ sandbox/threadpool/libs/tp/test/test_unbounded_queue_priority.cpp 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -50,13 +50,13 @@
tp::pool<
tp::unbounded_channel< tp::priority< int > >
> pool( tp::poolsize( 1) );
- tp::task< int > tsk(
+ tp::task< int > t(
pool.submit(
boost::bind(
fibonacci_fn,
10),
0) );
- BOOST_CHECK_EQUAL( tsk.get(), 55);
+ BOOST_CHECK_EQUAL( t.result().get(), 55);
}
// check shutdown
@@ -73,7 +73,7 @@
0) );
pool.shutdown();
BOOST_CHECK( pool.terminated() );
- BOOST_CHECK_EQUAL( t.get(), 55);
+ BOOST_CHECK_EQUAL( t.result().get(), 55);
}
// check runtime_error throw inside task
@@ -82,7 +82,7 @@
tp::pool<
tp::unbounded_channel< tp::priority< int > >
> pool( tp::poolsize( 1) );
- tp::task< void > tsk(
+ tp::task< void > t(
pool.submit(
boost::bind(
throwing_fn),
@@ -90,7 +90,7 @@
pool.shutdown();
bool thrown( false);
try
- { tsk.get(); }
+ { t.result().get(); }
catch ( std::runtime_error const&)
{ thrown = true; }
BOOST_CHECK( thrown);
@@ -128,7 +128,7 @@
boost::bind(
fibonacci_fn,
10) );
- tp::task< int > tsk(
+ tp::task< int > t(
pool.submit(
boost::bind(
( int ( *)( boost::function< int() > const&, pt::time_duration const&) ) delay_fn,
@@ -146,7 +146,7 @@
BOOST_CHECK_EQUAL( pool.active(), std::size_t( 0) );
bool thrown( false);
try
- { tsk.get(); }
+ { t.result().get(); }
catch ( boost::thread_interrupted const&)
{ thrown = true; }
BOOST_CHECK( thrown);
@@ -164,7 +164,7 @@
boost::bind(
fibonacci_fn,
10) );
- tp::task< int > tsk1(
+ tp::task< int > t1(
pool.submit(
boost::bind(
( int ( *)( boost::function< int() > const&, boost::barrier &) ) barrier_fn,
@@ -173,16 +173,16 @@
0) );
boost::this_thread::sleep( pt::millisec( 250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 0) );
- tp::task< int > tsk2( pool.submit( fn, 0) );
+ tp::task< int > t2( pool.submit( fn, 0) );
boost::this_thread::sleep( pt::millisec(250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 1) );
- tp::task< int > tsk3( pool.submit( fn, 0) );
+ tp::task< int > t3( pool.submit( fn, 0) );
boost::this_thread::sleep( pt::millisec(250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 2) );
b.wait();
- BOOST_CHECK_EQUAL( tsk1.get(), 55);
- BOOST_CHECK_EQUAL( tsk2.get(), 55);
- BOOST_CHECK_EQUAL( tsk3.get(), 55);
+ BOOST_CHECK_EQUAL( t1.result().get(), 55);
+ BOOST_CHECK_EQUAL( t2.result().get(), 55);
+ BOOST_CHECK_EQUAL( t3.result().get(), 55);
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 0) );
}
@@ -198,13 +198,12 @@
boost::bind(
fibonacci_fn,
10) );
- tp::task< int > tsk1(
- pool.submit(
- boost::bind(
- ( int ( *)( boost::function< int() > const&, boost::barrier &) ) barrier_fn,
- fn,
- boost::ref( b) ),
- 0) );
+ pool.submit(
+ boost::bind(
+ ( int ( *)( boost::function< int() > const&, boost::barrier &) ) barrier_fn,
+ fn,
+ boost::ref( b) ),
+ 0);
std::vector< int > buffer;
pool.submit(
boost::bind(
@@ -244,7 +243,7 @@
boost::ref( b) ),
0);
std::vector< int > buffer;
- tp::task< void > tsk(
+ tp::task< void > t(
pool.submit(
boost::bind(
buffer_fibonacci_fn,
@@ -257,14 +256,14 @@
boost::ref( buffer),
0),
0);
- tsk.interrupt();
+ t.interrupt();
b.wait();
pool.shutdown();
BOOST_CHECK_EQUAL( buffer[0], 0);
BOOST_CHECK_EQUAL( buffer.size(), std::size_t( 1) );
bool thrown( false);
try
- { tsk.get(); }
+ { t.result().get(); }
catch ( boost::thread_interrupted const&)
{ thrown = true; }
BOOST_CHECK( thrown);
==============================================================================
--- sandbox/threadpool/libs/tp/test/test_unbounded_queue_smart.cpp (original)
+++ sandbox/threadpool/libs/tp/test/test_unbounded_queue_smart.cpp 2009-03-02 15:15:58 EST (Mon, 02 Mar 2009)
@@ -50,13 +50,13 @@
tp::pool<
tp::unbounded_channel< tp::smart< int, std::less< int >, tp::replace_oldest, tp::take_oldest > >
> pool( tp::poolsize( 1) );
- tp::task< int > tsk(
+ tp::task< int > t(
pool.submit(
boost::bind(
fibonacci_fn,
10),
0) );
- BOOST_CHECK_EQUAL( tsk.get(), 55);
+ BOOST_CHECK_EQUAL( t.result().get(), 55);
}
// check shutdown
@@ -73,7 +73,7 @@
0) );
pool.shutdown();
BOOST_CHECK( pool.terminated() );
- BOOST_CHECK_EQUAL( t.get(), 55);
+ BOOST_CHECK_EQUAL( t.result().get(), 55);
}
// check runtime_error throw inside task
@@ -82,7 +82,7 @@
tp::pool<
tp::unbounded_channel< tp::smart< int, std::less< int >, tp::replace_oldest, tp::take_oldest > >
> pool( tp::poolsize( 1) );
- tp::task< void > tsk(
+ tp::task< void > t(
pool.submit(
boost::bind(
throwing_fn),
@@ -90,7 +90,7 @@
pool.shutdown();
bool thrown( false);
try
- { tsk.get(); }
+ { t.result().get(); }
catch ( std::runtime_error const&)
{ thrown = true; }
BOOST_CHECK( thrown);
@@ -128,7 +128,7 @@
boost::bind(
fibonacci_fn,
10) );
- tp::task< int > tsk(
+ tp::task< int > t(
pool.submit(
boost::bind(
( int ( *)( boost::function< int() > const&, pt::time_duration const&) ) delay_fn,
@@ -146,7 +146,7 @@
BOOST_CHECK_EQUAL( pool.active(), std::size_t( 0) );
bool thrown( false);
try
- { tsk.get(); }
+ { t.result().get(); }
catch ( boost::thread_interrupted const&)
{ thrown = true; }
BOOST_CHECK( thrown);
@@ -164,7 +164,7 @@
boost::bind(
fibonacci_fn,
10) );
- tp::task< int > tsk1(
+ tp::task< int > t1(
pool.submit(
boost::bind(
( int ( *)( boost::function< int() > const&, boost::barrier &) ) barrier_fn,
@@ -173,16 +173,16 @@
0) );
boost::this_thread::sleep( pt::millisec( 250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 0) );
- tp::task< int > tsk2( pool.submit( fn, 1) );
+ tp::task< int > t2( pool.submit( fn, 1) );
boost::this_thread::sleep( pt::millisec(250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 1) );
- tp::task< int > tsk3( pool.submit( fn, 2) );
+ tp::task< int > t3( pool.submit( fn, 2) );
boost::this_thread::sleep( pt::millisec(250) );
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 2) );
b.wait();
- BOOST_CHECK_EQUAL( tsk1.get(), 55);
- BOOST_CHECK_EQUAL( tsk2.get(), 55);
- BOOST_CHECK_EQUAL( tsk3.get(), 55);
+ BOOST_CHECK_EQUAL( t1.result().get(), 55);
+ BOOST_CHECK_EQUAL( t2.result().get(), 55);
+ BOOST_CHECK_EQUAL( t3.result().get(), 55);
BOOST_CHECK_EQUAL( pool.pending(), std::size_t( 0) );
}
@@ -198,13 +198,12 @@
boost::bind(
fibonacci_fn,
10) );
- tp::task< int > tsk1(
- pool.submit(
- boost::bind(
- ( int ( *)( boost::function< int() > const&, boost::barrier &) ) barrier_fn,
- fn,
- boost::ref( b) ),
- 0) );
+ pool.submit(
+ boost::bind(
+ ( int ( *)( boost::function< int() > const&, boost::barrier &) ) barrier_fn,
+ fn,
+ boost::ref( b) ),
+ 0);
std::vector< int > buffer;
pool.submit(
boost::bind(
@@ -250,7 +249,7 @@
boost::ref( b) ),
0);
std::vector< int > buffer;
- tp::task< void > tsk(
+ tp::task< void > t(
pool.submit(
boost::bind(
buffer_fibonacci_fn,
@@ -263,14 +262,14 @@
boost::ref( buffer),
0),
1);
- tsk.interrupt();
+ t.interrupt();
b.wait();
pool.shutdown();
BOOST_CHECK_EQUAL( buffer[0], 0);
BOOST_CHECK_EQUAL( buffer.size(), std::size_t( 1) );
bool thrown( false);
try
- { tsk.get(); }
+ { t.result().get(); }
catch ( boost::thread_interrupted const&)
{ thrown = true; }
BOOST_CHECK( thrown);