|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r58535 - in sandbox/task: boost boost/task boost/task/detail boost/task/spin libs/task/doc libs/task/src libs/task/src/spin libs/task/test
From: oliver.kowalke_at_[hidden]
Date: 2009-12-27 18:07:05
Author: olli
Date: 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
New Revision: 58535
URL: http://svn.boost.org/trac/boost/changeset/58535
Log:
update
Text files modified:
sandbox/task/boost/task.hpp | 14 ++++-----
sandbox/task/boost/task/as_sub_task.hpp | 41 +++++------------------------
sandbox/task/boost/task/async.hpp | 18 ++++++++++++
sandbox/task/boost/task/callable.hpp | 42 ++++++++++++++++++++++++++----
sandbox/task/boost/task/detail/guard.hpp | 6 ++--
sandbox/task/boost/task/detail/pool_base.hpp | 55 +++++++++++++++++++++------------------
sandbox/task/boost/task/detail/worker.hpp | 23 ++--------------
sandbox/task/boost/task/detail/wsq.hpp | 6 ++--
sandbox/task/boost/task/exceptions.hpp | 4 +-
sandbox/task/boost/task/handle.hpp | 55 ++++++++++++++++++++++++++-------------
sandbox/task/boost/task/new_thread.hpp | 8 ++--
sandbox/task/boost/task/own_thread.hpp | 8 ++--
sandbox/task/boost/task/spin/bounded_channel.hpp | 6 ++++
sandbox/task/boost/task/spin/future.hpp | 20 +++++++-------
sandbox/task/boost/task/spin/unbounded_channel.hpp | 6 ++++
sandbox/task/boost/task/task.hpp | 6 ++++
sandbox/task/libs/task/doc/ref_handle.qbk | 6 ++--
sandbox/task/libs/task/doc/ref_utility.qbk | 2
sandbox/task/libs/task/src/guard.cpp | 12 +++-----
sandbox/task/libs/task/src/spin/auto_reset_event.cpp | 2
sandbox/task/libs/task/src/spin/manual_reset_event.cpp | 2
sandbox/task/libs/task/src/spin/mutex.cpp | 2
sandbox/task/libs/task/src/watermark.cpp | 4 +-
sandbox/task/libs/task/src/worker.cpp | 4 --
sandbox/task/libs/task/src/wsq.cpp | 50 ++++++++++++++++++------------------
sandbox/task/libs/task/test/Jamfile.v2 | 22 +++++++--------
sandbox/task/libs/task/test/test_as_sub_task.cpp | 2
sandbox/task/libs/task/test/test_new_thread.cpp | 7 ++--
sandbox/task/libs/task/test/test_own_thread.cpp | 7 ++--
sandbox/task/libs/task/test/test_spin_auto_reset_event.cpp | 12 ++++----
sandbox/task/libs/task/test/test_spin_count_down_event.cpp | 10 +++---
sandbox/task/libs/task/test/test_spin_manual_reset_event.cpp | 12 ++++----
32 files changed, 254 insertions(+), 220 deletions(-)
Modified: sandbox/task/boost/task.hpp
==============================================================================
--- sandbox/task/boost/task.hpp (original)
+++ sandbox/task/boost/task.hpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -9,10 +9,9 @@
#include <boost/task/as_sub_task.hpp>
#include <boost/task/async.hpp>
-#include <boost/task/bounded_onelock_fifo.hpp>
-#include <boost/task/bounded_onelock_prio_queue.hpp>
-#include <boost/task/bounded_onelock_smart_queue.hpp>
-#include <boost/task/bounded_twolock_fifo.hpp>
+#include <boost/task/bounded_fifo.hpp>
+#include <boost/task/bounded_prio_queue.hpp>
+#include <boost/task/bounded_smart_queue.hpp>
#include <boost/task/callable.hpp>
#include <boost/task/context.hpp>
#include <boost/task/exceptions.hpp>
@@ -33,10 +32,9 @@
#include <boost/task/stacksize.hpp>
#include <boost/task/static_pool.hpp>
#include <boost/task/task.hpp>
-#include <boost/task/unbounded_onelock_fifo.hpp>
-#include <boost/task/unbounded_onelock_prio_queue.hpp>
-#include <boost/task/unbounded_onelock_smart_queue.hpp>
-#include <boost/task/unbounded_twolock_fifo.hpp>
+#include <boost/task/unbounded_prio_queue.hpp>
+#include <boost/task/unbounded_smart_queue.hpp>
+#include <boost/task/unbounded_fifo.hpp>
#include <boost/task/utility.hpp>
#include <boost/task/watermark.hpp>
Modified: sandbox/task/boost/task/as_sub_task.hpp
==============================================================================
--- sandbox/task/boost/task/as_sub_task.hpp (original)
+++ sandbox/task/boost/task/as_sub_task.hpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -9,67 +9,42 @@
#include <boost/bind.hpp>
#include <boost/config.hpp>
-#include <boost/function.hpp>
+#include <boost/move/move.hpp>
#include <boost/shared_ptr.hpp>
-#include <boost/thread/detail/move.hpp>
#include <boost/weak_ptr.hpp>
#include <boost/task/callable.hpp>
#include <boost/task/context.hpp>
#include <boost/task/detail/worker.hpp>
-#include <boost/thread/future.hpp>
#include <boost/task/handle.hpp>
#include <boost/task/new_thread.hpp>
+#include <boost/task/spin/future.hpp>
#include <boost/task/task.hpp>
#include <boost/config/abi_prefix.hpp>
namespace boost {
namespace tasks {
-namespace {
-
-template< typename R >
-bool future_ready( weak_ptr< shared_future< R > > wptr)
-{
- shared_ptr< shared_future< R > > sptr = wptr.lock();
- BOOST_ASSERT( sptr);
- bool res = sptr->is_ready();
- if ( res)
- fprintf(stdout,"future is ready\n");
- else
- fprintf(stdout,"future is not ready\n");
- return res;
-}
-
-}
struct as_sub_task
{
template< typename R >
- handle< R > operator()( task< R > t)
+ handle< R > operator()( BOOST_RV_REF( task< R >) t_)
{
detail::worker * w( detail::worker::tss_get() );
if ( w)
{
- shared_ptr< shared_future< R > > f(
- new shared_future< R >(
+ spin::packaged_task< R > t( t_.task_.fn_);
+ shared_ptr< spin::shared_future< R > > f(
+ new spin::shared_future< R >(
t.get_future() ) );
- function< bool() > wcb(
- bind(
- ( bool (*) ( weak_ptr< shared_future< R > >) ) & future_ready,
- weak_ptr< shared_future< R > >( f) ) );
- t.set_wait_callback(
- bind(
- ( void ( detail::worker::*)( function< bool() > const&) ) & detail::worker::reschedule_until,
- w,
- wcb) );
context ctx;
handle< R > h( f, ctx);
- w->put( callable( boost::move( t), ctx) );
+ w->put( callable( t, ctx) );
return h;
}
else
- return new_thread()( boost::move( t) );
+ return new_thread()( t_);
}
};
Modified: sandbox/task/boost/task/async.hpp
==============================================================================
--- sandbox/task/boost/task/async.hpp (original)
+++ sandbox/task/boost/task/async.hpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -8,7 +8,7 @@
#define BOOST_TASKS_ASYNC_H
#include <boost/config.hpp>
-#include <boost/thread/detail/move.hpp>
+#include <boost/move/move.hpp>
#include <boost/task/as_sub_task.hpp>
#include <boost/task/handle.hpp>
@@ -24,18 +24,34 @@
handle< R > async( task< R > t)
{ return as_sub_task()( boost::move( t) ); }
+template< typename R >
+handle< R > async( BOOST_RV_REF( task< R >) t)
+{ return as_sub_task()( t); }
+
template< typename R, typename EP >
handle< R > async( task< R > t, EP ep)
{ return ep( boost::move( t) ); }
+template< typename R, typename EP >
+handle< R > async( BOOST_RV_REF( task< R >) t, EP ep)
+{ return ep( t); }
+
template< typename R, typename Queue, typename UMS >
handle< R > async( task< R > t, static_pool< Queue, UMS > & pool)
{ return pool.submit( boost::move( t) ); }
+template< typename R, typename Queue, typename UMS >
+handle< R > async( BOOST_RV_REF( task< R >) t, static_pool< Queue, UMS > & pool)
+{ return pool.submit( t); }
+
template< typename R, typename Attr, typename Queue, typename UMS >
handle< R > async( task< R > t, Attr attr, static_pool< Queue, UMS > & pool)
{ return pool.submit( boost::move( t), attr); }
+template< typename R, typename Attr, typename Queue, typename UMS >
+handle< R > async( BOOST_RV_REF( task< R >) t, Attr attr, static_pool< Queue, UMS > & pool)
+{ return pool.submit( t, attr); }
+
}}
#include <boost/config/abi_suffix.hpp>
Modified: sandbox/task/boost/task/callable.hpp
==============================================================================
--- sandbox/task/boost/task/callable.hpp (original)
+++ sandbox/task/boost/task/callable.hpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -8,11 +8,13 @@
#define BOOST_TASKS_CALLABLE_H
#include <boost/config.hpp>
+#include <boost/move/move.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>
#include <boost/task/context.hpp>
#include <boost/task/detail/config.hpp>
+#include <boost/task/spin/future.hpp>
#include <boost/task/task.hpp>
#include <boost/config/abi_prefix.hpp>
@@ -36,17 +38,38 @@
};
template< typename R >
- class impl_wrapper : public impl
+ class task_wrapper : public impl
{
private:
task< R > t_;
context ctx_;
public:
- impl_wrapper(
- task< R > t,
+ task_wrapper(
+ BOOST_RV_REF( task< R >) t,
context const& ctx) :
- t_( boost::move( t) ), ctx_( ctx)
+ t_( t), ctx_( ctx)
+ {}
+
+ void run()
+ { t_(); }
+
+ void reset( shared_ptr< thread > const& thrd)
+ { ctx_.reset( thrd); }
+ };
+
+ template< typename R >
+ class packaged_task_wrapper : public impl
+ {
+ private:
+ spin::packaged_task< R > t_;
+ context ctx_;
+
+ public:
+ packaged_task_wrapper(
+ BOOST_RV_REF( spin::packaged_task< R >) t,
+ context const& ctx) :
+ t_( t), ctx_( ctx)
{}
void run()
@@ -63,9 +86,16 @@
template< typename R >
callable(
- task< R > t,
+ BOOST_RV_REF( task< R >) t,
+ context const& ctx) :
+ impl_( new task_wrapper< R >( t, ctx) )
+ {}
+
+ template< typename R >
+ callable(
+ BOOST_RV_REF( spin::packaged_task< R >) t,
context const& ctx) :
- impl_( new impl_wrapper< R >( boost::move( t), ctx) )
+ impl_( new packaged_task_wrapper< R >( t, ctx) )
{}
void operator()();
Modified: sandbox/task/boost/task/detail/guard.hpp
==============================================================================
--- sandbox/task/boost/task/detail/guard.hpp (original)
+++ sandbox/task/boost/task/detail/guard.hpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -7,7 +7,7 @@
#ifndef BOOST_TASKS_DETAIL_GUARD_H
#define BOOST_TASKS_DETAIL_GUARD_H
-#include <boost/cstdint.hpp>
+#include <boost/atomic.hpp>
#include <boost/utility.hpp>
#include <boost/task/detail/config.hpp>
@@ -26,10 +26,10 @@
class BOOST_TASKS_DECL guard : private noncopyable
{
private:
- volatile uint32_t & active_worker_;
+ atomic< unsigned int > & active_worker_;
public:
- guard( volatile uint32_t & active_worker);
+ guard( atomic< unsigned int > & active_worker);
~guard();
};
Modified: sandbox/task/boost/task/detail/pool_base.hpp
==============================================================================
--- sandbox/task/boost/task/detail/pool_base.hpp (original)
+++ sandbox/task/boost/task/detail/pool_base.hpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -10,15 +10,14 @@
#include <cstddef>
#include <boost/assert.hpp>
+#include <boost/atomic.hpp>
#include <boost/bind.hpp>
#include <boost/config.hpp>
-#include <boost/cstdint.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>
#include <boost/thread/detail/move.hpp>
-#include <boost/task/detail/atomic.hpp>
#include <boost/task/detail/bind_processor.hpp>
#include <boost/task/detail/worker.hpp>
#include <boost/task/detail/worker_group.hpp>
@@ -56,13 +55,19 @@
typedef typename queue_type::value_type value_type;
typedef UMS ums_type;
- worker_group wg_;
- shared_mutex mtx_wg_;
- volatile uint32_t state_;
- queue_type queue_;
- volatile uint32_t idle_worker_;
- bool shtdwn_;
- bool shtdwn_now_;
+ enum state
+ {
+ ACTIVE = 0,
+ DEACTIVE
+ };
+
+ worker_group wg_;
+ shared_mutex mtx_wg_;
+ atomic< state > state_;
+ queue_type queue_;
+ atomic< unsigned int > idle_worker_;
+ atomic< bool > shtdwn_;
+ atomic< bool > shtdwn_now_;
void worker_entry_()
{
@@ -124,11 +129,11 @@
std::size_t size_() const
{ return wg_.size(); }
- bool closed_() const
- { return state_ > 0; }
+ bool deactivated_() const
+ { return DEACTIVE == state_.load(); }
- bool close_()
- { return atomic_fetch_add( & state_, 1) > 0; }
+ bool deactivate_()
+ { return ACTIVE == state_.exchange( DEACTIVE); }
public:
explicit pool_base(
@@ -138,7 +143,7 @@
stacksize const& stack_size) :
wg_(),
mtx_wg_(),
- state_( 0),
+ state_( ACTIVE),
queue_(),
idle_worker_( 0),
shtdwn_( false),
@@ -160,7 +165,7 @@
stacksize const& stack_size) :
wg_(),
mtx_wg_(),
- state_( 0),
+ state_( ACTIVE),
queue_( hwm, lwm),
idle_worker_( 0),
shtdwn_( false),
@@ -180,7 +185,7 @@
stacksize const& stack_size) :
wg_(),
mtx_wg_(),
- state_( 0),
+ state_( ACTIVE),
queue_(),
idle_worker_( 0),
shtdwn_( false),
@@ -203,7 +208,7 @@
stacksize const& stack_size) :
wg_(),
mtx_wg_(),
- state_( 0),
+ state_( ACTIVE),
queue_( hwm, lwm),
idle_worker_( 0),
shtdwn_( false),
@@ -224,7 +229,7 @@
void interrupt_all_worker()
{
- if ( closed_() ) return;
+ if ( deactivated_() ) return;
shared_lock< shared_mutex > lk( mtx_wg_);
wg_.interrupt_all();
@@ -232,21 +237,21 @@
void shutdown()
{
- if ( closed_() || close_() ) return;
+ if ( deactivated_() || ! deactivate_() ) return;
queue_.deactivate();
shared_lock< shared_mutex > lk( mtx_wg_);
- shtdwn_ = true;
+ shtdwn_.store( true);
wg_.join_all();
}
const void shutdown_now()
{
- if ( closed_() || close_() ) return;
+ if ( deactivated_() || ! deactivate_() ) return;
queue_.deactivate();
shared_lock< shared_mutex > lk( mtx_wg_);
- shtdwn_now_ = true;
+ shtdwn_now_.store( true);
wg_.interrupt_all();
wg_.join_all();
}
@@ -258,7 +263,7 @@
}
bool closed()
- { return closed_(); }
+ { return deactivated_(); }
std::size_t upper_bound()
{ return queue_.upper_bound(); }
@@ -275,7 +280,7 @@
template< typename R >
handle< R > submit( task< R > t)
{
- if ( closed_() )
+ if ( deactivated_() )
throw task_rejected("pool is closed");
shared_ptr< shared_future< R > > f(
@@ -290,7 +295,7 @@
template< typename R, typename Attr >
handle< R > submit( task< R > t, Attr const& attr)
{
- if ( closed_() )
+ if ( deactivated_() )
throw task_rejected("pool is closed");
shared_ptr< shared_future< R > > f(
Modified: sandbox/task/boost/task/detail/worker.hpp
==============================================================================
--- sandbox/task/boost/task/detail/worker.hpp (original)
+++ sandbox/task/boost/task/detail/worker.hpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -53,8 +53,6 @@
virtual void run() = 0;
- virtual void reschedule_until( function< bool() > const&) = 0;
-
virtual void block() = 0;
};
@@ -259,23 +257,6 @@
}
}
- void reschedule_until( function< bool() > const& pred)
- {
- while (true)
- {
- if ( pred() )
- {
- fprintf(stdout,"predicate is true- will return\n");
- break;
- }
- else
- {
- fprintf(stdout,"predicate is not true - will block\n");
- block();
- }
- }
- }
-
void block()
{
if ( 0 == sched_.ready() )
@@ -326,13 +307,15 @@
const thread::id get_id() const;
void join() const;
+
void interrupt() const;
void put( callable const&);
+
bool try_steal( callable &);
void run();
- void reschedule_until( function< bool() > const&);
+
void block();
static worker * tss_get();
Modified: sandbox/task/boost/task/detail/wsq.hpp
==============================================================================
--- sandbox/task/boost/task/detail/wsq.hpp (original)
+++ sandbox/task/boost/task/detail/wsq.hpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -7,7 +7,7 @@
#ifndef BOOST_TASKS_DETAIL_WSQ_H
#define BOOST_TASKS_DETAIL_WSQ_H
-#include <boost/cstdint.hpp>
+#include <boost/atomic.hpp>
#include <boost/shared_array.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/utility.hpp>
@@ -33,8 +33,8 @@
shared_array< callable > array_;
int capacity_;
int mask_;
- volatile uint32_t head_idx_;
- volatile uint32_t tail_idx_;
+ atomic< unsigned int > head_idx_;
+ atomic< unsigned int > tail_idx_;
recursive_mutex mtx_;
public:
Modified: sandbox/task/boost/task/exceptions.hpp
==============================================================================
--- sandbox/task/boost/task/exceptions.hpp (original)
+++ sandbox/task/boost/task/exceptions.hpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -50,8 +50,8 @@
class invalid_watermark : public std::invalid_argument
{
public:
- invalid_watermark( std::string const& msg) :
- std::invalid_argument( msg)
+ invalid_watermark() :
+ std::invalid_argument("invalid watermark")
{}
};
Modified: sandbox/task/boost/task/handle.hpp
==============================================================================
--- sandbox/task/boost/task/handle.hpp (original)
+++ sandbox/task/boost/task/handle.hpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -22,10 +22,32 @@
namespace boost {
namespace tasks {
+template< typename T >
+struct is_handle_type;
+
template< typename R >
class handle
{
private:
+ template< typename T1, typename T2 >
+ friend void waitfor_all( handle< T1 > &, handle< T2 > &);
+ template< typename T1, typename T2, typename T3 >
+ friend void waitfor_all( handle< T1 > &, handle< T2 > &, handle< T3 > &);
+ template< typename T1, typename T2, typename T3, typename T4 >
+ friend void waitfor_all( handle< T1 > &, handle< T2 > &, handle< T3 > &, handle< T4 > &);
+ template< typename T1, typename T2, typename T3, typename T4, typename T5 >
+ friend void waitfor_all( handle< T1 > &, handle< T2 > &, handle< T3 > &, handle< T4 > &, handle< T5 > &);
+ template< typename Iterator >
+ friend typename disable_if< is_handle_type< Iterator >, Iterator >::type waitfor_any( Iterator begin, Iterator end);
+ template< typename H1, typename H2 >
+ friend typename enable_if< is_handle_type< H1 >, unsigned >::type waitfor_any( H1 &, H2 &);
+ template< typename T1, typename T2, typename T3 >
+ friend unsigned int waitfor_any( handle< T1 > &, handle< T2 > &, handle< T3 > &);
+ template< typename T1, typename T2, typename T3, typename T4 >
+ friend unsigned int waitfor_any( handle< T1 > &, handle< T2 > &, handle< T3 > &, handle< T4 > &);
+ template< typename T1, typename T2, typename T3, typename T4, typename T5 >
+ friend unsigned int waitfor_any( handle< T1 > &, handle< T2 > &, handle< T3 > &, handle< T4 > &, handle< T5 > &);
+
shared_ptr< shared_future< R > > fut_;
context ctx_;
@@ -56,8 +78,8 @@
return wait_until( abs_time);
}
- template< typename Duration >
- bool interrupt_and_wait_for( Duration const& rel_time)
+ template< typename TimeDuration >
+ bool interrupt_and_wait_for( TimeDuration const& rel_time)
{
interrupt();
return wait_for( rel_time);
@@ -99,8 +121,8 @@
{ throw task_interrupted(); }
}
- template< typename Duration >
- bool wait_for( Duration const& rel_time) const
+ template< typename TimeDuration >
+ bool wait_for( TimeDuration const& rel_time) const
{
try
{ return fut_->timed_wait( rel_time); }
@@ -124,9 +146,6 @@
{ throw task_interrupted(); }
}
- shared_future< R > & get_future()
- { return * fut_; }
-
void swap( handle< R > & other)
{
fut_.swap( other.fut_);
@@ -160,7 +179,7 @@
void waitfor_all( handle< T1 > & t1, handle< T2 > & t2)
{
try
- { wait_for_all( t1.get_future(), t2.get_future()); }
+ { wait_for_all( * t1.fut_, * t2.fut_); }
catch ( thread_interrupted const&)
{ throw task_interrupted(); }
}
@@ -169,7 +188,7 @@
void waitfor_all( handle< T1 > & t1, handle< T2 > & t2, handle< T3 > & t3)
{
try
- { wait_for_all( t1.get_future(), t2.get_future(), t3.get_future()); }
+ { wait_for_all( * t1.fut_, * t2.fut_, * t3.fut_); }
catch ( thread_interrupted const&)
{ throw task_interrupted(); }
}
@@ -178,7 +197,7 @@
void waitfor_all( handle< T1 > & t1, handle< T2 > & t2, handle< T3 > & t3, handle< T4 > & t4)
{
try
- { wait_for_all( t1.get_future(), t2.get_future(), t3.get_future(), t4.get_future()); }
+ { wait_for_all( * t1.fut_, * t2.fut_, * t3.fut_, * t4.fut_); }
catch ( thread_interrupted const&)
{ throw task_interrupted(); }
}
@@ -187,7 +206,7 @@
void waitfor_all( handle< T1 > & t1, handle< T2 > & t2, handle< T3 > & t3, handle< T4 > & t4, handle< T5 > & t5)
{
try
- { wait_for_all( t1.get_future(), t2.get_future(), t3.get_future(), t4.get_future(), t5.get_future()); }
+ { wait_for_all( * t1.fut_, * t2.fut_, * t3.fut_, * t4.fut_, * t5.fut_); }
catch ( thread_interrupted const&)
{ throw task_interrupted(); }
}
@@ -199,18 +218,18 @@
{
boost::detail::future_waiter waiter;
for ( Iterator i = begin; i != end; ++i)
- waiter.add( i->fut_);
+ waiter.add( * ( i->fut_) );
return next( begin, waiter.wait() );
}
catch ( thread_interrupted const&)
{ throw task_interrupted(); }
}
-template< typename T1, typename T2 >
-unsigned int waitfor_any( handle< T1 > & t1, handle< T2 > & t2)
+template< typename H1, typename H2 >
+typename enable_if< is_handle_type< H1 >, unsigned >::type waitfor_any( H1 & h1, H2 & h2)
{
try
- { return wait_for_any( t1.get_future(), t2.get_future() ); }
+ { return wait_for_any( * h1.fut_, * h2.fut_ ); }
catch ( thread_interrupted const&)
{ throw task_interrupted(); }
}
@@ -219,7 +238,7 @@
unsigned int waitfor_any( handle< T1 > & t1, handle< T2 > & t2, handle< T3 > & t3)
{
try
- { return wait_for_any( t1.get_future(), t2.get_future(), t3.get_future() ); }
+ { return wait_for_any( * t1.fut_, * t2.fut_, * t3.fut_ ); }
catch ( thread_interrupted const&)
{ throw task_interrupted(); }
}
@@ -228,7 +247,7 @@
unsigned int waitfor_any( handle< T1 > & t1, handle< T2 > & t2, handle< T3 > & t3, handle< T4 > & t4)
{
try
- { return wait_for_any( t1.get_future(), t2.get_future(), t3.get_future(), t4.get_future() ); }
+ { return wait_for_any( * t1.fut_, * t2.fut_, * t3.fut_, * t4.fut_ ); }
catch ( thread_interrupted const&)
{ throw task_interrupted(); }
}
@@ -237,7 +256,7 @@
unsigned int waitfor_any( handle< T1 > & t1, handle< T2 > & t2, handle< T3 > & t3, handle< T4 > & t4, handle< T5 > & t5)
{
try
- { return wait_for_any( t1.get_future(), t2.get_future(), t3.get_future(), t4.get_future(), t5.get_future() ); }
+ { return wait_for_any( * t1.fut_, * t2.fut_, * t3.fut_, * t4.fut_, * t5.fut_ ); }
catch ( thread_interrupted const&)
{ throw task_interrupted(); }
}
Modified: sandbox/task/boost/task/new_thread.hpp
==============================================================================
--- sandbox/task/boost/task/new_thread.hpp (original)
+++ sandbox/task/boost/task/new_thread.hpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -9,13 +9,13 @@
#include <boost/assert.hpp>
#include <boost/config.hpp>
+#include <boost/move/move.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>
-#include <boost/thread/detail/move.hpp>
+#include <boost/thread/future.hpp>
#include <boost/task/callable.hpp>
#include <boost/task/context.hpp>
-#include <boost/thread/future.hpp>
#include <boost/task/handle.hpp>
#include <boost/task/task.hpp>
@@ -63,14 +63,14 @@
public:
template< typename R >
- handle< R > operator()( task< R > t)
+ handle< R > operator()( BOOST_RV_REF( task< R >) t)
{
shared_ptr< shared_future< R > > f(
new shared_future< R >(
t.get_future() ) );
context ctx1, ctx2;
handle< R > h( f, ctx1);
- callable ca( boost::move( t), ctx2);
+ callable ca( t, ctx2);
shared_ptr< thread > thrd(
new thread( wrapper( ca) ),
detail::joiner() );
Modified: sandbox/task/boost/task/own_thread.hpp
==============================================================================
--- sandbox/task/boost/task/own_thread.hpp (original)
+++ sandbox/task/boost/task/own_thread.hpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -8,12 +8,12 @@
#define BOOST_TASKS_OWN_THREAD_H
#include <boost/config.hpp>
+#include <boost/move/move.hpp>
#include <boost/shared_ptr.hpp>
-#include <boost/thread/detail/move.hpp>
+#include <boost/thread/future.hpp>
#include <boost/task/callable.hpp>
#include <boost/task/context.hpp>
-#include <boost/thread/future.hpp>
#include <boost/task/handle.hpp>
#include <boost/task/task.hpp>
@@ -25,14 +25,14 @@
struct own_thread
{
template< typename R >
- handle< R > operator()( task< R > t)
+ handle< R > operator()( BOOST_RV_REF( task< R >) t)
{
shared_ptr< shared_future< R > > f(
new shared_future< R >(
t.get_future() ) );
context ctx;
handle< R > h( f, ctx);
- callable ca( boost::move( t), ctx);
+ callable ca( t, ctx);
ca();
return h;
}
Modified: sandbox/task/boost/task/spin/bounded_channel.hpp
==============================================================================
--- sandbox/task/boost/task/spin/bounded_channel.hpp (original)
+++ sandbox/task/boost/task/spin/bounded_channel.hpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -169,6 +169,9 @@
std::size_t lower_bound() const
{ return lwm_; }
+ bool active() const
+ { return active_(); }
+
void deactivate()
{ deactivate_(); }
@@ -348,6 +351,9 @@
std::size_t lower_bound() const
{ return impl_->lower_bound(); }
+
+ bool active() const
+ { return impl_->active(); }
void deactivate()
{ impl_->deactivate(); }
Modified: sandbox/task/boost/task/spin/future.hpp
==============================================================================
--- sandbox/task/boost/task/spin/future.hpp (original)
+++ sandbox/task/boost/task/spin/future.hpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -4,8 +4,8 @@
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
-#ifndef BOOST_FIBERS_SPIN_FUTURE_HPP
-#define BOOST_FIBERS_SPIN_FUTURE_HPP
+#ifndef BOOST_TASKS_SPIN_FUTURE_HPP
+#define BOOST_TASKS_SPIN_FUTURE_HPP
#include <algorithm>
#include <list>
@@ -23,12 +23,12 @@
#include <boost/shared_ptr.hpp>
#include <boost/utility/enable_if.hpp>
-#include <boost/fiber/detail/future_traits.hpp>
-#include <boost/fiber/spin/condition.hpp>
-#include <boost/fiber/spin/mutex.hpp>
+#include <boost/task/detail/future_traits.hpp>
+#include <boost/task/spin/condition.hpp>
+#include <boost/task/spin/mutex.hpp>
namespace boost {
-namespace fibers {
+namespace tasks {
namespace future_state {
@@ -44,8 +44,8 @@
boost::exception_ptr exception;
bool done;
mutex mtx;
- condition waiters;
- typedef std::list<condition*> waiter_list;
+ spin::condition waiters;
+ typedef std::list<spin::condition*> waiter_list;
waiter_list external_waiters;
boost::function<void()> callback;
@@ -56,7 +56,7 @@
virtual ~future_object_base()
{}
- waiter_list::iterator register_external_waiter(condition& cv)
+ waiter_list::iterator register_external_waiter(spin::condition& cv)
{
boost::unique_lock<mutex> lock(mtx);
do_callback(lock);
@@ -1078,4 +1078,4 @@
}}}
-#endif // BOOST_FIBERS_SPIN_FUTURE_H
+#endif // BOOST_TASKS_SPIN_FUTURE_H
Modified: sandbox/task/boost/task/spin/unbounded_channel.hpp
==============================================================================
--- sandbox/task/boost/task/spin/unbounded_channel.hpp (original)
+++ sandbox/task/boost/task/spin/unbounded_channel.hpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -112,6 +112,9 @@
use_count_( 0)
{}
+ bool active() const
+ { return active_(); }
+
void deactivate()
{ deactivate_(); }
@@ -215,6 +218,9 @@
impl_( new impl() )
{}
+ bool active() const
+ { return impl_->active(); }
+
void deactivate()
{ impl_->deactivate(); }
Modified: sandbox/task/boost/task/task.hpp
==============================================================================
--- sandbox/task/boost/task/task.hpp (original)
+++ sandbox/task/boost/task/task.hpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -60,6 +60,8 @@
class task_wrapper : public task_base< R >
{
private:
+ friend struct as_sub_task;
+
Fn fn_;
void do_run()
@@ -116,6 +118,8 @@
class task_wrapper< void, Fn > : public task_base< void >
{
private:
+ friend struct as_sub_task;
+
Fn fn_;
void do_run()
@@ -177,6 +181,8 @@
class task
{
private:
+ friend struct as_sub_task;
+
BOOST_MOVABLE_BUT_NOT_COPYABLE( task);
shared_ptr< detail::task_base< R > > task_;
Modified: sandbox/task/libs/task/doc/ref_handle.qbk
==============================================================================
--- sandbox/task/libs/task/doc/ref_handle.qbk (original)
+++ sandbox/task/libs/task/doc/ref_handle.qbk 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -19,7 +19,7 @@
void interrupt();
void interrupt_and_wait();
void interrupt_and_wait_until( system_time const& abs_time);
- template< typename Duration >
+ template< typename TimeDuration >
void interrupt_and_wait_for( Duration const& rel_time);
bool interruption_requested();
@@ -116,7 +116,7 @@
[heading Member function `interrupt_and_wait_for()`]
- template< typename Duration >
+ template< typename TimeDuration >
bool interrupt_and_wait_for( Duration const& rel_time)
[variablelist
@@ -148,7 +148,7 @@
[heading Member function `wait_for()`]
- template< typename Duration >
+ template< typename TimeDuration >
bool wait_for( Duration const& rel_time) const
[variablelist
Modified: sandbox/task/libs/task/doc/ref_utility.qbk
==============================================================================
--- sandbox/task/libs/task/doc/ref_utility.qbk (original)
+++ sandbox/task/libs/task/doc/ref_utility.qbk 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -83,7 +83,7 @@
void delay( system_time abs_time)
- template< typename Duration >
+ template< typename TimeDuration >
void delay( Duration const& rel_time)
``
Modified: sandbox/task/libs/task/src/guard.cpp
==============================================================================
--- sandbox/task/libs/task/src/guard.cpp (original)
+++ sandbox/task/libs/task/src/guard.cpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -8,23 +8,21 @@
#include <boost/assert.hpp>
-#include <boost/task/detail/atomic.hpp>
-
namespace boost {
namespace tasks {
namespace detail {
-guard::guard( volatile uint32_t & active_worker) :
+guard::guard( atomic< unsigned int > & active_worker) :
active_worker_( active_worker)
{
- BOOST_ASSERT( active_worker_ >= 0);
- atomic_fetch_add( & active_worker_, 1);
+ BOOST_ASSERT( 0 <= active_worker_.load() );
+ active_worker_.fetch_add( 1);
}
guard::~guard()
{
- atomic_fetch_sub( & active_worker_, 1);
- BOOST_ASSERT( active_worker_ >= 0);
+ active_worker_.fetch_sub( 1);
+ BOOST_ASSERT( 0 <= active_worker_.load() );
}
}}}
Modified: sandbox/task/libs/task/src/spin/auto_reset_event.cpp
==============================================================================
--- sandbox/task/libs/task/src/spin/auto_reset_event.cpp (original)
+++ sandbox/task/libs/task/src/spin/auto_reset_event.cpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -20,7 +20,7 @@
void
auto_reset_event::set()
-{ state_.exchange( SET); }
+{ state_.store( SET); }
void
auto_reset_event::wait()
Modified: sandbox/task/libs/task/src/spin/manual_reset_event.cpp
==============================================================================
--- sandbox/task/libs/task/src/spin/manual_reset_event.cpp (original)
+++ sandbox/task/libs/task/src/spin/manual_reset_event.cpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -38,7 +38,7 @@
mutex::scoped_lock lk( enter_mtx_);
BOOST_ASSERT( lk);
- state_.exchange( RESET);
+ state_.store( RESET);
}
void
Modified: sandbox/task/libs/task/src/spin/mutex.cpp
==============================================================================
--- sandbox/task/libs/task/src/spin/mutex.cpp (original)
+++ sandbox/task/libs/task/src/spin/mutex.cpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -72,6 +72,6 @@
void
mutex::unlock()
-{ state_.exchange( UNLOCKED); }
+{ state_.store( UNLOCKED); }
}}}
Modified: sandbox/task/libs/task/src/watermark.cpp
==============================================================================
--- sandbox/task/libs/task/src/watermark.cpp (original)
+++ sandbox/task/libs/task/src/watermark.cpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -15,7 +15,7 @@
value_( value)
{
if ( value <= 0)
- throw invalid_watermark("high watermark must be greater than zero");
+ throw invalid_watermark();
}
high_watermark::operator std::size_t () const
@@ -25,7 +25,7 @@
: value_( value)
{
if ( value < 0)
- throw invalid_watermark("low watermark must be greater than or equal to zero");
+ throw invalid_watermark();
}
low_watermark::operator std::size_t () const
Modified: sandbox/task/libs/task/src/worker.cpp
==============================================================================
--- sandbox/task/libs/task/src/worker.cpp (original)
+++ sandbox/task/libs/task/src/worker.cpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -41,10 +41,6 @@
}
void
-worker::reschedule_until( function< bool() > const& pred)
-{ impl_->reschedule_until( pred); }
-
-void
worker::block()
{ impl_->block(); }
Modified: sandbox/task/libs/task/src/wsq.cpp
==============================================================================
--- sandbox/task/libs/task/src/wsq.cpp (original)
+++ sandbox/task/libs/task/src/wsq.cpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -8,14 +8,11 @@
#include <boost/thread/locks.hpp>
-#include <boost/task/detail/atomic.hpp>
+namespace boost {
+namespace tasks {
+namespace detail {
-namespace boost { namespace tasks {
-namespace detail
-{
-
-wsq::wsq()
-:
+wsq::wsq() :
initial_size_( 32),
array_( new callable[ initial_size_]),
capacity_( initial_size_),
@@ -27,25 +24,25 @@
bool
wsq::empty() const
-{ return head_idx_ >= tail_idx_; }
+{ return head_idx_.load() >= tail_idx_.load(); }
std::size_t
wsq::size() const
-{ return tail_idx_ - head_idx_; }
+{ return tail_idx_.load() - head_idx_.load(); }
void
wsq::put( callable const& ca)
{
- uint32_t tail( tail_idx_);
- if ( tail <= head_idx_ + mask_)
+ unsigned int tail( tail_idx_.load() );
+ if ( tail <= head_idx_.load() + mask_)
{
array_[tail & mask_] = ca;
- tail_idx_ = tail + 1;
+ tail_idx_.fetch_add( 1);
}
else
{
lock_guard< recursive_mutex > lk( mtx_);
- uint32_t head( head_idx_);
+ unsigned int head( head_idx_.load() );
int count( size() );
if ( count >= mask_)
@@ -55,24 +52,26 @@
for ( int i( 0); i != count; ++i)
array[i] = array_[(i + head) & mask_];
array_.swap( array);
- head_idx_ = 0;
- tail_idx_ = tail = count;
+ head_idx_.store( 0);
+ tail = count;
+ tail_idx_.store( tail);
mask_ = (mask_ << 1) | 1;
}
array_[tail & mask_] = ca;
- tail_idx_ = tail + 1;
+ tail_idx_.fetch_add( 1);
}
}
bool
wsq::try_take( callable & ca)
{
- uint32_t tail( tail_idx_);
+ unsigned int tail( tail_idx_.load() );
if ( tail == 0)
return false;
tail -= 1;
- atomic_exchange( & tail_idx_, tail);
- if ( head_idx_ <= tail)
+ tail_idx_.exchange( tail);
+ //tail_idx_.store( tail);
+ if ( head_idx_.load() <= tail)
{
ca.swap( array_[tail & mask_]);
return true;
@@ -80,14 +79,14 @@
else
{
lock_guard< recursive_mutex > lk( mtx_);
- if ( head_idx_ <= tail)
+ if ( head_idx_.load() <= tail)
{
ca.swap( array_[tail & mask_]);
return true;
}
else
{
- tail_idx_ = tail + 1;
+ tail_idx_.fetch_add( 1);
return false;
}
}
@@ -99,16 +98,17 @@
recursive_mutex::scoped_try_lock lk( mtx_);
if ( lk.owns_lock() )
{
- uint32_t head( head_idx_);
- atomic_exchange( & head_idx_, head + 1);
- if ( head < tail_idx_)
+ unsigned int head( head_idx_.load() );
+ head_idx_.exchange( head + 1);
+ //head_idx_.store( head + 1);
+ if ( head < tail_idx_.load() )
{
ca.swap( array_[head & mask_]);
return true;
}
else
{
- head_idx_ = head;
+ head_idx_.store( head);
return false;
}
}
Modified: sandbox/task/libs/task/test/Jamfile.v2
==============================================================================
--- sandbox/task/libs/task/test/Jamfile.v2 (original)
+++ sandbox/task/libs/task/test/Jamfile.v2 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -29,19 +29,17 @@
[ task-test test_task ]
[ task-test test_own_thread ]
[ task-test test_new_thread ]
- [ task-test test_unbounded_twolock_pool ]
- [ task-test test_unbounded_onelock_pool ]
- [ task-test test_bounded_twolock_pool ]
- [ task-test test_bounded_onelock_pool ]
- [ task-test test_as_sub_task ]
- [ task-test test_spin::mutex ]
- [ task-test test_spin::condition ]
- [ task-test test_spin::condition_notify_all ]
- [ task-test test_spin::condition_notify_one ]
- [ task-test test_spin::condition_timed_wait_times_out ]
+ [ task-test test_unbounded_pool ]
+ [ task-test test_bounded_pool ]
+# [ task-test test_as_sub_task ]
+ [ task-test test_spin_mutex ]
+ [ task-test test_spin_condition ]
+ [ task-test test_spin_condition_notify_all ]
+ [ task-test test_spin_condition_notify_one ]
+ [ task-test test_spin_condition_timed_wait_times_out ]
[ task-test test_spin_count_down_event ]
[ task-test test_spin_auto_reset_event ]
[ task-test test_spin_manual_reset_event ]
- [ task-test test_unbounded_buffer ]
- [ task-test test_bounded_buffer ]
+ [ task-test test_spin_unbounded_channel ]
+ [ task-test test_spin_bounded_channel ]
;
Modified: sandbox/task/libs/task/test/test_as_sub_task.cpp
==============================================================================
--- sandbox/task/libs/task/test/test_as_sub_task.cpp (original)
+++ sandbox/task/libs/task/test/test_as_sub_task.cpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -47,7 +47,7 @@
void test_runs_in_pool()
{
tsk::static_pool<
- tsk::unbounded_onelock_fifo
+ tsk::unbounded_fifo
> pool( tsk::poolsize( 1) );
tsk::handle< bool > h(
tsk::async(
Modified: sandbox/task/libs/task/test/test_new_thread.cpp
==============================================================================
--- sandbox/task/libs/task/test/test_new_thread.cpp (original)
+++ sandbox/task/libs/task/test/test_new_thread.cpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -246,16 +246,15 @@
// check waitfor_any()
void test_case_17()
{
- tsk::task< void > t1( delay_fn, pt::seconds( 3) );
- tsk::task< int > t2( fibonacci_fn, 10);
+ tsk::task< void > t1( delay_fn, pt::seconds( 2) );
+ tsk::task< void > t2( delay_fn, pt::seconds( 1) );
tsk::handle< void > h1(
tsk::async( boost::move( t1), tsk::new_thread() ) );
- tsk::handle< int > h2(
+ tsk::handle< void > h2(
tsk::async( boost::move( t2), tsk::new_thread() ) );
tsk::waitfor_any( h1, h2);
BOOST_CHECK( ! h1.is_ready() );
BOOST_CHECK( h2.is_ready() );
- BOOST_CHECK_EQUAL( h2.get(), 55);
}
boost::unit_test::test_suite * init_unit_test_suite( int, char* [])
Modified: sandbox/task/libs/task/test/test_own_thread.cpp
==============================================================================
--- sandbox/task/libs/task/test/test_own_thread.cpp (original)
+++ sandbox/task/libs/task/test/test_own_thread.cpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -261,16 +261,15 @@
// check waitfor_any()
void test_case_18()
{
- tsk::task< void > t1( delay_fn, pt::seconds( 3) );
- tsk::task< int > t2( fibonacci_fn, 10);
+ tsk::task< void > t1( delay_fn, pt::seconds( 2) );
+ tsk::task< void > t2( delay_fn, pt::seconds( 1) );
tsk::handle< void > h1(
tsk::async( boost::move( t1), tsk::own_thread() ) );
- tsk::handle< int > h2(
+ tsk::handle< void > h2(
tsk::async( boost::move( t2), tsk::own_thread() ) );
tsk::waitfor_any( h1, h2);
BOOST_CHECK( h1.is_ready() );
BOOST_CHECK( h2.is_ready() );
- BOOST_CHECK_EQUAL( h2.get(), 55);
}
// check interrupt + wait
Modified: sandbox/task/libs/task/test/test_spin_auto_reset_event.cpp
==============================================================================
--- sandbox/task/libs/task/test/test_spin_auto_reset_event.cpp (original)
+++ sandbox/task/libs/task/test/test_spin_auto_reset_event.cpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -24,7 +24,7 @@
namespace pt = boost::posix_time;
namespace tsk = boost::tasks;
-boost::uint32_t wait_fn( boost::uint32_t n, tsk::spin_auto_reset_event & ev)
+boost::uint32_t wait_fn( boost::uint32_t n, tsk::spin::auto_reset_event & ev)
{
ev.wait();
return n;
@@ -34,7 +34,7 @@
void test_case_1()
{
boost::uint32_t n = 3;
- tsk::spin_auto_reset_event ev;
+ tsk::spin::auto_reset_event ev;
tsk::handle< boost::uint32_t > h1(
tsk::async(
@@ -87,11 +87,11 @@
void test_case_2()
{
tsk::static_pool<
- tsk::unbounded_onelock_fifo
+ tsk::unbounded_fifo
> pool( tsk::poolsize( 3) );
boost::uint32_t n = 3;
- tsk::spin_auto_reset_event ev;
+ tsk::spin::auto_reset_event ev;
tsk::handle< boost::uint32_t > h1(
tsk::async(
@@ -142,7 +142,7 @@
void test_case_3()
{
boost::uint32_t n = 3;
- tsk::spin_auto_reset_event ev( true);
+ tsk::spin::auto_reset_event ev( true);
tsk::handle< boost::uint32_t > h1(
tsk::async(
@@ -187,7 +187,7 @@
void test_case_4()
{
- tsk::spin_auto_reset_event ev;
+ tsk::spin::auto_reset_event ev;
BOOST_CHECK_EQUAL( false, ev.try_wait() );
Modified: sandbox/task/libs/task/test/test_spin_count_down_event.cpp
==============================================================================
--- sandbox/task/libs/task/test/test_spin_count_down_event.cpp (original)
+++ sandbox/task/libs/task/test/test_spin_count_down_event.cpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -24,7 +24,7 @@
namespace pt = boost::posix_time;
namespace tsk = boost::tasks;
-boost::uint32_t wait_fn( boost::uint32_t n, tsk::spin_count_down_event & ev)
+boost::uint32_t wait_fn( boost::uint32_t n, tsk::spin::count_down_event & ev)
{
ev.wait();
return n;
@@ -34,7 +34,7 @@
void test_case_1()
{
boost::uint32_t n = 3;
- tsk::spin_count_down_event ev( n);
+ tsk::spin::count_down_event ev( n);
BOOST_CHECK_EQUAL( ev.initial(), n);
BOOST_CHECK_EQUAL( ev.current(), n);
@@ -59,7 +59,7 @@
void test_case_2()
{
boost::uint32_t n = 3;
- tsk::spin_count_down_event ev( n);
+ tsk::spin::count_down_event ev( n);
BOOST_CHECK_EQUAL( ev.initial(), n);
BOOST_CHECK_EQUAL( ev.current(), n);
@@ -84,11 +84,11 @@
void test_case_3()
{
tsk::static_pool<
- tsk::unbounded_onelock_fifo
+ tsk::unbounded_fifo
> pool( tsk::poolsize( 3) );
boost::uint32_t n = 3;
- tsk::spin_count_down_event ev( n);
+ tsk::spin::count_down_event ev( n);
BOOST_CHECK_EQUAL( ev.initial(), n);
BOOST_CHECK_EQUAL( ev.current(), n);
Modified: sandbox/task/libs/task/test/test_spin_manual_reset_event.cpp
==============================================================================
--- sandbox/task/libs/task/test/test_spin_manual_reset_event.cpp (original)
+++ sandbox/task/libs/task/test/test_spin_manual_reset_event.cpp 2009-12-27 18:07:02 EST (Sun, 27 Dec 2009)
@@ -24,7 +24,7 @@
namespace pt = boost::posix_time;
namespace tsk = boost::tasks;
-boost::uint32_t wait_fn( boost::uint32_t n, tsk::spin_manual_reset_event & ev)
+boost::uint32_t wait_fn( boost::uint32_t n, tsk::spin::manual_reset_event & ev)
{
ev.wait();
return n;
@@ -34,7 +34,7 @@
void test_case_1()
{
boost::uint32_t n = 3;
- tsk::spin_manual_reset_event ev;
+ tsk::spin::manual_reset_event ev;
tsk::handle< boost::uint32_t > h1(
tsk::async(
@@ -93,11 +93,11 @@
void test_case_2()
{
tsk::static_pool<
- tsk::unbounded_onelock_fifo
+ tsk::unbounded_fifo
> pool( tsk::poolsize( 3) );
boost::uint32_t n = 3;
- tsk::spin_manual_reset_event ev;
+ tsk::spin::manual_reset_event ev;
tsk::handle< boost::uint32_t > h1(
tsk::async(
@@ -155,7 +155,7 @@
void test_case_3()
{
boost::uint32_t n = 3;
- tsk::spin_manual_reset_event ev( true);
+ tsk::spin::manual_reset_event ev( true);
tsk::handle< boost::uint32_t > h1(
tsk::async(
@@ -206,7 +206,7 @@
void test_case_4()
{
- tsk::spin_manual_reset_event ev;
+ tsk::spin::manual_reset_event ev;
BOOST_CHECK_EQUAL( false, ev.try_wait() );
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