Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52582 - in sandbox/task: boost/task boost/task/detail libs/task/src
From: oliver.kowalke_at_[hidden]
Date: 2009-04-24 14:51:52


Author: olli
Date: 2009-04-24 14:51:50 EDT (Fri, 24 Apr 2009)
New Revision: 52582
URL: http://svn.boost.org/trac/boost/changeset/52582

Log:
* using boost::uint32_t from <boost/ctdint.hpp>

Text files modified:
   sandbox/task/boost/task/detail/atomic.hpp | 7 ++++---
   sandbox/task/boost/task/detail/guard.hpp | 5 +++--
   sandbox/task/boost/task/detail/worker.hpp | 14 ++++++++++----
   sandbox/task/boost/task/detail/wsq.hpp | 1 +
   sandbox/task/boost/task/launch.hpp | 8 ++++----
   sandbox/task/boost/task/pool.hpp | 7 ++++---
   sandbox/task/libs/task/src/guard.cpp | 2 +-
   7 files changed, 27 insertions(+), 17 deletions(-)

Modified: sandbox/task/boost/task/detail/atomic.hpp
==============================================================================
--- sandbox/task/boost/task/detail/atomic.hpp (original)
+++ sandbox/task/boost/task/detail/atomic.hpp 2009-04-24 14:51:50 EDT (Fri, 24 Apr 2009)
@@ -8,6 +8,7 @@
 #define BOOST_TASK_DETAIL_ATOMIC_H
 
 #include <boost/assert.hpp>
+#include <boost/cstdint.hpp>
 #include <boost/interprocess/detail/atomic.hpp>
 
 namespace boost { namespace task
@@ -15,18 +16,18 @@
 namespace detail
 {
 inline
-void atomic_exchange( volatile unsigned int * object, unsigned int desired)
+void atomic_exchange( volatile uint32_t * object, uint32_t desired)
 { interprocess::detail::atomic_write32( object, desired); }
 
 inline
-unsigned int atomic_fetch_add( volatile unsigned int * object, unsigned int operand)
+unsigned int atomic_fetch_add( volatile uint32_t * object, uint32_t operand)
 {
         BOOST_ASSERT( operand == 1);
         return interprocess::detail::atomic_dec32( object);
 }
 
 inline
-unsigned int atomic_fetch_sub( volatile unsigned int * object, unsigned int operand)
+unsigned int atomic_fetch_sub( volatile uint32_t * object, uint32_t operand)
 {
         BOOST_ASSERT( operand == 1);
         return interprocess::detail::atomic_inc32( object);

Modified: sandbox/task/boost/task/detail/guard.hpp
==============================================================================
--- sandbox/task/boost/task/detail/guard.hpp (original)
+++ sandbox/task/boost/task/detail/guard.hpp 2009-04-24 14:51:50 EDT (Fri, 24 Apr 2009)
@@ -7,6 +7,7 @@
 #ifndef BOOST_TASK_DETAIL_GUARD_H
 #define BOOST_TASK_DETAIL_GUARD_H
 
+#include <boost/cstdint.hpp>
 #include <boost/utility.hpp>
 
 #include <boost/task/detail/config.hpp>
@@ -20,10 +21,10 @@
 class BOOST_TASK_DECL guard : private noncopyable
 {
 private:
- unsigned int & active_worker_;
+ volatile uint32_t & active_worker_;
 
 public:
- guard( unsigned int & active_worker);
+ guard( volatile uint32_t & active_worker);
 
         ~guard();
 };

Modified: sandbox/task/boost/task/detail/worker.hpp
==============================================================================
--- sandbox/task/boost/task/detail/worker.hpp (original)
+++ sandbox/task/boost/task/detail/worker.hpp 2009-04-24 14:51:50 EDT (Fri, 24 Apr 2009)
@@ -144,14 +144,20 @@
                         }
                 }
         
- void next_callable__( callable & ca)
+ void next_local_callable_( callable & ca)
                 {
                         if ( ! try_take( ca) )
                         {
                                 guard grd( get_pool().idle_worker_);
                                 if ( shutdown_() ) return;
- this_thread::yield();
- this_thread::sleep( asleep_);
+ ++scns_;
+ if ( scns_ >= max_scns_)
+ {
+ this_thread::sleep( asleep_);
+ scns_ = 0;
+ }
+ else
+ this_thread::yield();
                         }
                 }
 
@@ -258,7 +264,7 @@
                         callable ca;
                         while ( ! pred() )
                         {
- next_callable__( ca);
+ next_local_callable_( ca);
                                 if( ! ca.empty() )
                                 {
                                         execute_( ca);

Modified: sandbox/task/boost/task/detail/wsq.hpp
==============================================================================
--- sandbox/task/boost/task/detail/wsq.hpp (original)
+++ sandbox/task/boost/task/detail/wsq.hpp 2009-04-24 14:51:50 EDT (Fri, 24 Apr 2009)
@@ -7,6 +7,7 @@
 #ifndef BOOST_TASK_DETAIL_WSQ_H
 #define BOOST_TASK_DETAIL_WSQ_H
 
+#include <boost/cstdint.hpp>
 #include <boost/shared_array.hpp>
 #include <boost/thread/mutex.hpp>
 #include <boost/utility.hpp>

Modified: sandbox/task/boost/task/launch.hpp
==============================================================================
--- sandbox/task/boost/task/launch.hpp (original)
+++ sandbox/task/boost/task/launch.hpp 2009-04-24 14:51:50 EDT (Fri, 24 Apr 2009)
@@ -15,14 +15,14 @@
 namespace boost { namespace task
 {
 template< typename R >
-handle< R > launch( task< R > t)
+handle< R > launch_in_pool( task< R > t)
 { return get_default_pool().submit( t); }
 
 template<
         typename R,
         typename Attr
>
-handle< R > launch(
+handle< R > launch_in_pool(
         task< R > t,
         Attr const& attr)
 { return get_default_pool().submit( t, attr); }
@@ -31,7 +31,7 @@
         typename Channel,
         typename R
>
-handle< R > launch(
+handle< R > launch_in_pool(
         pool< Channel > & pool,
         task< R > t)
 { return pool.submit( t); }
@@ -41,7 +41,7 @@
         typename R,
         typename Attr
>
-handle< R > launch(
+handle< R > launch_in_pool(
         pool< Channel > & pool,
         task< R > t,
         Attr const& attr)

Modified: sandbox/task/boost/task/pool.hpp
==============================================================================
--- sandbox/task/boost/task/pool.hpp (original)
+++ sandbox/task/boost/task/pool.hpp 2009-04-24 14:51:50 EDT (Fri, 24 Apr 2009)
@@ -13,6 +13,7 @@
 
 #include <boost/assert.hpp>
 #include <boost/bind.hpp>
+#include <boost/cstdint.hpp>
 #include <boost/function.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
 #include <boost/thread.hpp>
@@ -46,10 +47,10 @@
 
         detail::worker_group wg_;
         shared_mutex mtx_wg_;
- unsigned int state_;
+ volatile uint32_t state_;
         channel channel_;
- unsigned int active_worker_;
- unsigned int idle_worker_;
+ volatile uint32_t active_worker_;
+ volatile uint32_t idle_worker_;
 
         void worker_entry_()
         {

Modified: sandbox/task/libs/task/src/guard.cpp
==============================================================================
--- sandbox/task/libs/task/src/guard.cpp (original)
+++ sandbox/task/libs/task/src/guard.cpp 2009-04-24 14:51:50 EDT (Fri, 24 Apr 2009)
@@ -14,7 +14,7 @@
 {
 namespace detail
 {
-guard::guard( unsigned int & active_worker)
+guard::guard( volatile uint32_t & active_worker)
 : active_worker_( active_worker)
 {
         BOOST_ASSERT( active_worker_ >= 0);


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk