Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58658 - in sandbox/fiber/boost: . fiber fiber/detail fiber/object fiber/spin
From: oliver.kowalke_at_[hidden]
Date: 2010-01-03 13:47:57


Author: olli
Date: 2010-01-03 13:47:56 EST (Sun, 03 Jan 2010)
New Revision: 58658
URL: http://svn.boost.org/trac/boost/changeset/58658

Log:
- code foramting issues

Text files modified:
   sandbox/fiber/boost/fiber.hpp | 1
   sandbox/fiber/boost/fiber/detail/future_traits.hpp | 2
   sandbox/fiber/boost/fiber/detail/info.hpp | 6
   sandbox/fiber/boost/fiber/detail/info_base_posix.hpp | 6
   sandbox/fiber/boost/fiber/detail/info_base_windows.hpp | 6
   sandbox/fiber/boost/fiber/exceptions.hpp | 28 +++---
   sandbox/fiber/boost/fiber/object/id.hpp | 8
   sandbox/fiber/boost/fiber/spin/bounded_channel.hpp | 20 ++--
   sandbox/fiber/boost/fiber/spin/future.hpp | 166 +++++++++++++++++++--------------------
   9 files changed, 118 insertions(+), 125 deletions(-)

Modified: sandbox/fiber/boost/fiber.hpp
==============================================================================
--- sandbox/fiber/boost/fiber.hpp (original)
+++ sandbox/fiber/boost/fiber.hpp 2010-01-03 13:47:56 EST (Sun, 03 Jan 2010)
@@ -27,6 +27,7 @@
 #include <boost/fiber/spin/manual_reset_event.hpp>
 #include <boost/fiber/spin/mutex.hpp>
 #include <boost/fiber/spin/unbounded_channel.hpp>
+#include <boost/fiber/strategy.hpp>
 #include <boost/fiber/unbounded_channel.hpp>
 #include <boost/fiber/utility.hpp>
 

Modified: sandbox/fiber/boost/fiber/detail/future_traits.hpp
==============================================================================
--- sandbox/fiber/boost/fiber/detail/future_traits.hpp (original)
+++ sandbox/fiber/boost/fiber/detail/future_traits.hpp 2010-01-03 13:47:56 EST (Sun, 03 Jan 2010)
@@ -52,7 +52,7 @@
         static void cleanup(storage_type& storage)
         { storage.reset(); }
 };
-
+
 template<typename T>
 struct future_traits<T&>
 {

Modified: sandbox/fiber/boost/fiber/detail/info.hpp
==============================================================================
--- sandbox/fiber/boost/fiber/detail/info.hpp (original)
+++ sandbox/fiber/boost/fiber/detail/info.hpp 2010-01-03 13:47:56 EST (Sun, 03 Jan 2010)
@@ -35,7 +35,7 @@
         info_default() :
                 info_base()
         {}
-
+
         void run()
         { BOOST_ASSERT( ! "run() of master-fiber should never be executed"); }
 };
@@ -78,7 +78,7 @@
                 info_base( stack_size),
                 fn_( fn)
         {}
-
+
         void run()
         { fn_(); }
 };
@@ -97,7 +97,7 @@
                 info_base( stack_size),
                 fn_( fn)
         {}
-
+
         void run()
         { fn_(); }
 };

Modified: sandbox/fiber/boost/fiber/detail/info_base_posix.hpp
==============================================================================
--- sandbox/fiber/boost/fiber/detail/info_base_posix.hpp (original)
+++ sandbox/fiber/boost/fiber/detail/info_base_posix.hpp 2010-01-03 13:47:56 EST (Sun, 03 Jan 2010)
@@ -39,8 +39,8 @@
 struct BOOST_FIBER_DECL info_base
 {
         typedef intrusive_ptr< info_base > ptr;
- typedef function< void() > callable_t;
- typedef std::stack< callable_t > callable_stack_t;
+ typedef function< void() > callable_t;
+ typedef std::stack< callable_t > callable_stack_t;
 
         unsigned int use_count;
         std::size_t stack_size;
@@ -50,7 +50,7 @@
         state_t state;
         interrupt_t interrupt;
         callable_stack_t at_exit;
- strategy * st;
+ strategy * st;
 
         info_base();
 

Modified: sandbox/fiber/boost/fiber/detail/info_base_windows.hpp
==============================================================================
--- sandbox/fiber/boost/fiber/detail/info_base_windows.hpp (original)
+++ sandbox/fiber/boost/fiber/detail/info_base_windows.hpp 2010-01-03 13:47:56 EST (Sun, 03 Jan 2010)
@@ -43,8 +43,8 @@
 struct BOOST_FIBER_DECL info_base
 {
         typedef intrusive_ptr< info_base > ptr;
- typedef function< void() > callable_t;
- typedef std::stack< callable_t > callable_stack_t;
+ typedef function< void() > callable_t;
+ typedef std::stack< callable_t > callable_stack_t;
 
         unsigned int use_count;
         std::size_t stack_size;
@@ -53,7 +53,7 @@
         state_t state;
         interrupt_t interrupt;
         callable_stack_t at_exit;
- strategy * st;
+ strategy * st;
 
         info_base();
 

Modified: sandbox/fiber/boost/fiber/exceptions.hpp
==============================================================================
--- sandbox/fiber/boost/fiber/exceptions.hpp (original)
+++ sandbox/fiber/boost/fiber/exceptions.hpp 2010-01-03 13:47:56 EST (Sun, 03 Jan 2010)
@@ -24,7 +24,7 @@
 class fiber_error : public std::runtime_error
 {
 public:
- fiber_error( std::string const& msg) :
+ fiber_error( std::string const& msg) :
                 std::runtime_error( msg)
         {}
 };
@@ -64,56 +64,56 @@
         {}
 };
 
-class future_uninitialized:
- public std::logic_error
+class future_uninitialized :
+ public std::logic_error
 {
 public:
- future_uninitialized():
+ future_uninitialized() :
         std::logic_error("Future Uninitialized")
     {}
 };
 
-class broken_promise:
+class broken_promise :
     public std::logic_error
 {
 public:
- broken_promise():
+ broken_promise() :
         std::logic_error("Broken promise")
     {}
 };
 
-class future_already_retrieved:
+class future_already_retrieved :
     public std::logic_error
 {
 public:
- future_already_retrieved():
+ future_already_retrieved() :
         std::logic_error("Future already retrieved")
     {}
 };
 
-class promise_already_satisfied:
+class promise_already_satisfied :
     public std::logic_error
 {
 public:
- promise_already_satisfied():
+ promise_already_satisfied() :
         std::logic_error("Promise already satisfied")
     {}
 };
 
-class task_already_started:
+class task_already_started :
     public std::logic_error
 {
 public:
- task_already_started():
+ task_already_started() :
         std::logic_error("Task already started")
     {}
 };
 
-class task_moved:
+class task_moved :
     public std::logic_error
 {
 public:
- task_moved():
+ task_moved() :
         std::logic_error("Task moved")
     {}
 };

Modified: sandbox/fiber/boost/fiber/object/id.hpp
==============================================================================
--- sandbox/fiber/boost/fiber/object/id.hpp (original)
+++ sandbox/fiber/boost/fiber/object/id.hpp 2010-01-03 13:47:56 EST (Sun, 03 Jan 2010)
@@ -35,16 +35,16 @@
 
         bool operator!=( id const& other) const
         { return vp_ != other.vp_; }
-
+
         bool operator<( id const& other) const
         { return vp_ < other.vp_; }
-
+
         bool operator>( id const& other) const
         { return other.vp_ < vp_; }
-
+
         bool operator<=( id const& other) const
         { return !( other.vp_ < vp_); }
-
+
         bool operator>=( id const& other) const
         { return ! ( vp_ < other.vp_); }
 

Modified: sandbox/fiber/boost/fiber/spin/bounded_channel.hpp
==============================================================================
--- sandbox/fiber/boost/fiber/spin/bounded_channel.hpp (original)
+++ sandbox/fiber/boost/fiber/spin/bounded_channel.hpp 2010-01-03 13:47:56 EST (Sun, 03 Jan 2010)
@@ -279,38 +279,38 @@
                         std::size_t lwm) :
                 impl_( new impl( hwm, lwm) )
         {}
-
+
         bounded_channel( std::size_t wm) :
                 impl_( new impl( wm) )
         {}
-
+
         void upper_bound( std::size_t hwm)
         { impl_->upper_bound( hwm); }
-
+
         std::size_t upper_bound() const
         { return impl_->upper_bound(); }
-
+
         void lower_bound( std::size_t lwm)
         { impl_->lower_bound( lwm); }
-
+
         std::size_t lower_bound() const
         { return impl_->lower_bound(); }
 
         bool active() const
         { return impl_->active(); }
-
+
         void deactivate()
         { impl_->deactivate(); }
-
+
         bool empty() const
         { return impl_->empty(); }
-
+
         void put( T const& t)
         { impl_->put( t); }
-
+
         bool take( value_type & va)
         { return impl_->take( va);}
-
+
         bool try_take( value_type & va)
         { return impl_->try_take( va); }
 };

Modified: sandbox/fiber/boost/fiber/spin/future.hpp
==============================================================================
--- sandbox/fiber/boost/fiber/spin/future.hpp (original)
+++ sandbox/fiber/boost/fiber/spin/future.hpp 2010-01-03 13:47:56 EST (Sun, 03 Jan 2010)
@@ -66,7 +66,7 @@
         do_callback(lock);
         return external_waiters.insert(external_waiters.end(),&cv);
     }
-
+
     void remove_external_waiter(waiter_list::iterator it)
     {
         boost::lock_guard<mutex> lock(mtx);
@@ -87,7 +87,7 @@
     struct relocker
     {
         boost::unique_lock<mutex>& lock;
-
+
         relocker(boost::unique_lock<mutex>& lock_):
             lock(lock_)
         {
@@ -108,7 +108,6 @@
             local_callback();
         }
     }
-
 
     void wait(bool rethrow=true)
     {
@@ -123,7 +122,7 @@
             boost::rethrow_exception(exception);
         }
     }
-
+
     void mark_exceptional_finish_internal(boost::exception_ptr const& e)
     {
         exception=e;
@@ -151,7 +150,7 @@
     {
         callback=boost::bind(f,boost::ref(*u));
     }
-
+
 private:
     future_object_base(future_object_base const&);
     future_object_base& operator=(future_object_base const&);
@@ -164,7 +163,7 @@
     typedef typename fibers::detail::future_traits<T>::source_reference_type source_reference_type;
     typedef typename fibers::detail::future_traits<T>::rvalue_source_type rvalue_source_type;
     typedef typename fibers::detail::future_traits<T>::move_dest_type move_dest_type;
-
+
     storage_type result;
 
     future_object():
@@ -238,7 +237,7 @@
     {
         wait();
     }
-
+
     future_state::state get_state()
     {
         boost::lock_guard<mutex> guard(mtx);
@@ -272,12 +271,12 @@
         {}
 
     };
-
+
     struct all_futures_lock
     {
         unsigned count;
         boost::scoped_array<boost::unique_lock<mutex> > locks;
-
+
         all_futures_lock(std::vector<registered_waiter>& futures):
             count(futures.size()),locks(new boost::unique_lock<mutex>[count])
         {
@@ -286,12 +285,12 @@
                 locks[i]=boost::unique_lock<mutex>(futures[i].future->mtx);
             }
         }
-
+
         void lock()
         {
             boost::lock(locks.get(),locks.get()+count);
         }
-
+
         void unlock()
         {
             for(unsigned i=0;i<count;++i)
@@ -300,16 +299,16 @@
             }
         }
     };
-
+
     condition cv;
     std::vector<registered_waiter> futures;
     unsigned future_count;
-
+
 public:
     future_waiter():
         future_count(0)
     {}
-
+
     template<typename F>
     void add(F& f)
     {
@@ -335,7 +334,7 @@
             cv.wait(lk);
         }
     }
-
+
     ~future_waiter()
     {
         for(unsigned i=0;i<futures.size();++i)
@@ -343,7 +342,7 @@
             futures[i].future->remove_external_waiter(futures[i].wait_iterator);
         }
     }
-
+
 };
 
 }
@@ -480,7 +479,7 @@
     typedef boost::shared_ptr<detail::future_object<R> > future_ptr;
 
         BOOST_MOVABLE_BUT_NOT_COPYABLE( unique_future);
-
+
     future_ptr future;
 
     friend class shared_future<R>;
@@ -499,28 +498,24 @@
 
     unique_future()
     {}
-
+
     ~unique_future()
     {}
 
         unique_future( BOOST_RV_REF( unique_future) other):
- future(other.future)
- {
- other.future.reset();
- }
-
+ future(other.future)
+ { other.future.reset(); }
+
         unique_future& operator=( BOOST_RV_REF( unique_future) other)
         {
- future=other.future;
- other.future.reset();
- return *this;
+ future=other.future;
+ other.future.reset();
+ return *this;
         }
-
+
         void swap(unique_future& other)
- {
- future.swap(other.future);
- }
-
+ { future.swap(other.future); }
+
         // retrieving the value
         move_dest_type get()
         {
@@ -531,7 +526,7 @@
         
             return future->get();
         }
-
+
         // functions to check state, and wait for ready
         state get_state() const
         {
@@ -541,23 +536,23 @@
             }
             return future->get_state();
         }
-
-
+
+
         bool is_ready() const
         {
             return get_state()==future_state::ready;
         }
-
+
         bool has_exception() const
         {
             return future && future->has_exception();
         }
-
+
         bool has_value() const
         {
             return future && future->has_value();
         }
-
+
         void wait() const
         {
             if(!future)
@@ -574,30 +569,30 @@
     typedef boost::shared_ptr<detail::future_object<R> > future_ptr;
 
         BOOST_COPYABLE_AND_MOVABLE( shared_future);
-
+
     future_ptr future;
 
         friend class detail::future_waiter;
         friend class promise<R>;
         friend class packaged_task<R>;
-
+
         shared_future(future_ptr future_):
             future(future_)
         {}
-
+
 public:
         shared_future(shared_future const& other):
             future(other.future)
         {}
-
+
         typedef future_state::state state;
-
+
         shared_future()
         {}
-
+
         ~shared_future()
         {}
-
+
         shared_future& operator=( BOOST_COPY_ASSIGN_REF( shared_future) other)
         {
             future=other.future;
@@ -609,11 +604,13 @@
         {
             other->future.reset();
         }
+
         shared_future( BOOST_RV_REF( unique_future<R>) other):
             future(other.future)
         {
             other.future.reset();
         }
+
         shared_future& operator=(BOOST_RV_REF( shared_future) other)
         {
             future.swap(other.future);
@@ -626,12 +623,12 @@
             other.future.reset();
             return *this;
         }
-
+
         void swap(shared_future& other)
         {
             future.swap(other.future);
         }
-
+
         // retrieving the value
         R get()
         {
@@ -642,7 +639,7 @@
         
             return future->get();
         }
-
+
         // functions to check state, and wait for ready
         state get_state() const
         {
@@ -652,23 +649,22 @@
             }
             return future->get_state();
         }
-
-
+
         bool is_ready() const
         {
             return get_state()==future_state::ready;
         }
-
+
         bool has_exception() const
         {
             return future && future->has_exception();
         }
-
+
         bool has_value() const
         {
             return future && future->has_value();
         }
-
+
         void wait() const
         {
             if(!future)
@@ -685,10 +681,10 @@
     typedef boost::shared_ptr<detail::future_object<R> > future_ptr;
 
         BOOST_MOVABLE_BUT_NOT_COPYABLE( promise);
-
+
     future_ptr future;
     bool future_obtained;
-
+
     void lazy_init()
     {
         if(!future)
@@ -697,14 +693,14 @@
             future.reset(new detail::future_object<R>);
         }
     }
-
+
 public:
 // template <class Allocator> explicit promise(Allocator a);
 
         promise():
             future(),future_obtained(false)
         {}
-
+
         ~promise()
         {
             if(future)
@@ -717,7 +713,7 @@
                 }
             }
         }
-
+
         promise( BOOST_RV_REF( promise) rhs):
             future(rhs.future),future_obtained(rhs.future_obtained)
         {
@@ -730,13 +726,13 @@
             rhs.future.reset();
             return *this;
         }
-
+
         void swap(promise& other)
         {
             future.swap(other.future);
             std::swap(future_obtained,other.future_obtained);
         }
-
+
         // Result retrieval
         unique_future<R> get_future()
         {
@@ -748,7 +744,7 @@
             future_obtained=true;
             return unique_future<R>(future);
         }
-
+
         void set_value(typename fibers::detail::future_traits<R>::source_reference_type r)
         {
             lazy_init();
@@ -759,7 +755,7 @@
             }
             future->mark_finished_with_result_internal(r);
         }
-
+
 // void set_value(R && r);
         void set_value(typename fibers::detail::future_traits<R>::rvalue_source_type r)
         {
@@ -771,7 +767,7 @@
             }
             future->mark_finished_with_result_internal(static_cast<typename fibers::detail::future_traits<R>::rvalue_source_type>(r));
         }
-
+
         void set_exception(boost::exception_ptr p)
         {
             lazy_init();
@@ -782,7 +778,7 @@
             }
             future->mark_exceptional_finish_internal(p);
         }
-
+
         template<typename F>
         void set_wait_callback(F f)
         {
@@ -798,10 +794,10 @@
     typedef boost::shared_ptr<detail::future_object<void> > future_ptr;
 
         BOOST_MOVABLE_BUT_NOT_COPYABLE( promise);
-
+
     future_ptr future;
     bool future_obtained;
-
+
     void lazy_init()
     {
         if(!future)
@@ -814,7 +810,7 @@
         promise():
             future(),future_obtained(false)
         {}
-
+
         ~promise()
         {
             if(future)
@@ -827,7 +823,7 @@
                 }
             }
         }
-
+
         promise( BOOST_RV_REF( promise) rhs):
             future(rhs.future),future_obtained(rhs.future_obtained)
         {
@@ -840,18 +836,18 @@
             rhs.future.reset();
             return *this;
         }
-
+
         void swap(promise& other)
         {
             future.swap(other.future);
             std::swap(future_obtained,other.future_obtained);
         }
-
+
         // Result retrieval
         unique_future<void> get_future()
         {
             lazy_init();
-
+
             if(future_obtained)
             {
                 throw future_already_retrieved();
@@ -859,7 +855,7 @@
             future_obtained=true;
             return unique_future<void>(future);
         }
-
+
         void set_value()
         {
             lazy_init();
@@ -870,7 +866,7 @@
             }
             future->mark_finished_with_result_internal();
         }
-
+
         void set_exception(boost::exception_ptr p)
         {
             lazy_init();
@@ -881,7 +877,7 @@
             }
             future->mark_exceptional_finish_internal(p);
         }
-
+
         template<typename F>
         void set_wait_callback(F f)
         {
@@ -924,12 +920,10 @@
             this->mark_exceptional_finish_internal(boost::copy_exception(broken_promise()));
         }
     }
-
-
+
     virtual void do_run()=0;
 };
 
-
 template<typename R,typename F>
 struct task_object:
     task_base<R>
@@ -941,7 +935,7 @@
     task_object( BOOST_RV_REF( F) f_):
         f(f_)
     {}
-
+
     void do_run()
     {
         try
@@ -966,7 +960,7 @@
     task_object( BOOST_RV_REF( F) f_):
         f(f_)
     {}
-
+
     void do_run()
     {
         try
@@ -991,12 +985,12 @@
 
     boost::shared_ptr<detail::task_base<R> > task;
     bool future_obtained;
-
+
 public:
     packaged_task():
         future_obtained(false)
     {}
-
+
     // construction and destruction
     template <class F>
     explicit packaged_task(F const& f):
@@ -1005,7 +999,7 @@
     explicit packaged_task(R(*f)()):
         task(new detail::task_object<R,R(*)()>(f)),future_obtained(false)
     {}
-
+
     template <class F>
     explicit packaged_task( BOOST_RV_REF( F) f):
         task(new detail::task_object<R,F>(f)),future_obtained(false)
@@ -1016,7 +1010,6 @@
 // template <class F, class Allocator>
 // explicit packaged_task(F&& f, Allocator a);
 
-
         ~packaged_task()
         {
             if(task)
@@ -1037,13 +1030,13 @@
             swap(temp);
             return *this;
         }
-
+
         void swap(packaged_task& other)
         {
             task.swap(other.task);
             std::swap(future_obtained,other.future_obtained);
         }
-
+
         // result retrieval
         unique_future<R> get_future()
         {
@@ -1061,8 +1054,7 @@
                 throw future_already_retrieved();
             }
         }
-
-
+
         // execution
         void operator()()
         {
@@ -1072,7 +1064,7 @@
             }
             task->run();
         }
-
+
         template<typename F>
         void set_wait_callback(F f)
         {


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