Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58470 - in sandbox/fiber: . boost/fiber boost/fiber/detail boost/fiber/spin libs/fiber/src libs/fiber/test
From: oliver.kowalke_at_[hidden]
Date: 2009-12-20 15:48:13


Author: olli
Date: 2009-12-20 15:48:12 EST (Sun, 20 Dec 2009)
New Revision: 58470
URL: http://svn.boost.org/trac/boost/changeset/58470

Log:
- boost.movefor move ops
- default stacksize now 64kB

Text files modified:
   sandbox/fiber/boost/fiber/detail/future_traits.hpp | 6
   sandbox/fiber/boost/fiber/detail/info.hpp | 11 -
   sandbox/fiber/boost/fiber/fiber.hpp | 114 ++++++----------------
   sandbox/fiber/boost/fiber/scheduler.hpp | 9 +
   sandbox/fiber/boost/fiber/spin/future.hpp | 198 ++++++++-------------------------------
   sandbox/fiber/change.log | 9 +
   sandbox/fiber/libs/fiber/src/fiber.cpp | 46 ++-------
   sandbox/fiber/libs/fiber/test/test_spin_future.cpp | 37 +-----
   8 files changed, 112 insertions(+), 318 deletions(-)

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 2009-12-20 15:48:12 EST (Sun, 20 Dec 2009)
@@ -13,10 +13,10 @@
 #include <vector>
 
 #include <boost/config.hpp>
+#include <boost/move/move.hpp>
 #include <boost/mpl/if.hpp>
 #include <boost/next_prior.hpp>
 #include <boost/scoped_ptr.hpp>
-#include <boost/thread/detail/move.hpp>
 #include <boost/type_traits/is_convertible.hpp>
 #include <boost/type_traits/is_fundamental.hpp>
 
@@ -35,8 +35,8 @@
         typedef typename boost::mpl::if_<boost::is_fundamental<T>,T,T&&>::type move_dest_type;
 #else
         typedef T& source_reference_type;
- typedef typename boost::mpl::if_<boost::is_convertible<T&,boost::detail::thread_move_t<T> >,boost::detail::thread_move_t<T>,T const&>::type rvalue_source_type;
- typedef typename boost::mpl::if_<boost::is_convertible<T&,boost::detail::thread_move_t<T> >,boost::detail::thread_move_t<T>,T>::type move_dest_type;
+ typedef typename boost::mpl::if_<boost::is_convertible<T&, BOOST_RV_REF( T) >, BOOST_RV_REF( T),T const&>::type rvalue_source_type;
+ typedef typename boost::mpl::if_<boost::is_convertible<T&,BOOST_RV_REF( T) >,BOOST_RV_REF( T),T>::type move_dest_type;
 #endif
 
         static void init(storage_type& storage,source_reference_type t)

Modified: sandbox/fiber/boost/fiber/detail/info.hpp
==============================================================================
--- sandbox/fiber/boost/fiber/detail/info.hpp (original)
+++ sandbox/fiber/boost/fiber/detail/info.hpp 2009-12-20 15:48:12 EST (Sun, 20 Dec 2009)
@@ -11,7 +11,7 @@
 
 #include <boost/assert.hpp>
 #include <boost/config.hpp>
-#include <boost/thread/detail/move.hpp>
+#include <boost/move/move.hpp>
 #include <boost/type_traits/remove_reference.hpp>
 
 #include <boost/fiber/detail/config.hpp>
@@ -48,22 +48,15 @@
         info & operator=( info const&);
 
 public:
-#ifdef BOOST_HAS_RVALUE_REFS
- thread_data( Fn && fn, std::size_t stack_size) :
- info_base( stack_size),
- fn_( static_cast< Fn && >( fn) )
- {}
-#else
         info( Fn fn, std::size_t stack_size) :
                 info_base( stack_size),
                 fn_( fn)
         {}
 
- info( boost::detail::thread_move_t< Fn > fn, std::size_t stack_size) :
+ info( BOOST_RV_REF( Fn) fn, std::size_t stack_size) :
                 info_base( stack_size),
                 fn_( fn)
         {}
-#endif
 
         void run()
         { fn_(); }

Modified: sandbox/fiber/boost/fiber/fiber.hpp
==============================================================================
--- sandbox/fiber/boost/fiber/fiber.hpp (original)
+++ sandbox/fiber/boost/fiber/fiber.hpp 2009-12-20 15:48:12 EST (Sun, 20 Dec 2009)
@@ -13,7 +13,7 @@
 #include <boost/bind.hpp>
 #include <boost/config.hpp>
 #include <boost/preprocessor/repetition.hpp>
-#include <boost/thread/detail/move.hpp>
+#include <boost/move/move.hpp>
 #include <boost/type_traits/remove_reference.hpp>
 #include <boost/utility/enable_if.hpp>
 #include <boost/utility.hpp>
@@ -31,7 +31,7 @@
 namespace boost {
 namespace fibers {
 
-#define BOOST_FIBER_DEFAULT_STACKSIZE 8192
+#define BOOST_FIBER_DEFAULT_STACKSIZE 64000
 
 template< typename Strategy >
 class scheduler;
@@ -44,11 +44,11 @@
         friend class scheduler;
         friend class strategy;
 
- struct dummy;
-
         static void convert_thread_to_fiber();
         static void convert_fiber_to_thread();
 
+ BOOST_COPYABLE_AND_MOVABLE( fiber);
+
         detail::info_base::ptr_t info_base_;
 
         explicit fiber( detail::info_base::ptr_t);
@@ -59,19 +59,6 @@
 
         void switch_to_( fiber &);
 
-#ifdef BOOST_HAS_RVALUE_REFS
- template< typename Fn >
- static detail::info_base::ptr_t make_info_(
- std::size_t stack_size, Fn && fn)
- {
- return detail::info_base::ptr_t(
- new detail::info< typename remove_reference< Fn >::type >(
- static_cast< Fn && >( fn), stack_size) );
- }
-
- static detail::info_base::ptr_t make_info_(
- std::size_t stack_size, void ( * fn)() );
-#else
         template< typename Fn >
         static detail::info_base::ptr_t make_info_(
                 std::size_t stack_size, Fn fn)
@@ -82,35 +69,17 @@
 
         template< typename Fn >
         static detail::info_base::ptr_t make_info_(
- std::size_t stack_size, boost::detail::thread_move_t< Fn > fn)
+ std::size_t stack_size, BOOST_RV_REF( Fn) fn)
         {
                 return detail::info_base::ptr_t(
                         new detail::info< Fn >( fn, stack_size) );
         }
-#endif
 
 public:
         class id;
 
         fiber();
 
-#ifdef BOOST_HAS_RVALUE_REFS
- template< typename Fn >
- fiber( Fn && fn) :
- info_base_( make_info_( BOOST_FIBER_DEFAULT_STACKSIZE, static_cast< Fn && >( fn) ) )
- { init_(); }
-
- fiber( std::size_t stack_size, Fn && fn) :
- info_base_( make_info_( stack_size, static_cast< Fn && >( fn) ) )
- { init_(); }
-
- fiber( fiber &&);
-
- fiber & operator=( fiber &&);
-
- fiber && move();
-#else
-#ifdef BOOST_NO_SFINAE
         template< typename Fn >
         explicit fiber( Fn fn) :
                 info_base_( make_info_( BOOST_FIBER_DEFAULT_STACKSIZE, fn) )
@@ -120,39 +89,6 @@
         explicit fiber( std::size_t stack_size, Fn fn) :
                 info_base_( make_info_( stack_size, fn) )
         { init_(); }
-#else
- template< typename Fn >
- explicit fiber(
- Fn fn,
- typename disable_if< boost::is_convertible< Fn &, boost::detail::thread_move_t< Fn > >, dummy * >::type = 0) :
- info_base_( make_info_( BOOST_FIBER_DEFAULT_STACKSIZE, fn) )
- { init_(); }
-
- template< typename Fn >
- explicit fiber(
- std::size_t stack_size, Fn fn,
- typename disable_if< boost::is_convertible< Fn &, boost::detail::thread_move_t< Fn > >, dummy * >::type = 0) :
- info_base_( make_info_( stack_size, fn) )
- { init_(); }
-#endif
- template< typename Fn >
- explicit fiber( boost::detail::thread_move_t< Fn > fn) :
- info_base_( make_info_( BOOST_FIBER_DEFAULT_STACKSIZE, fn) )
- { init_(); }
-
- template< typename Fn >
- explicit fiber( std::size_t stack_size, boost::detail::thread_move_t< Fn > fn) :
- info_base_( make_info_( stack_size, fn) )
- { init_(); }
-
- fiber( boost::detail::thread_move_t< fiber >);
-
- fiber & operator=( boost::detail::thread_move_t< fiber >);
-
- operator boost::detail::thread_move_t< fiber >();
-
- boost::detail::thread_move_t< fiber > move();
-#endif
 
 #define BOOST_FIBER_ARG(z, n, unused) \
    BOOST_PP_CAT(A, n) BOOST_PP_CAT(a, n)
@@ -166,6 +102,7 @@
                                 BOOST_FIBER_DEFAULT_STACKSIZE, \
                                 boost::bind( boost::type< void >(), fn, BOOST_PP_ENUM_PARAMS(n, a)) ) ) \
         { init_(); } \
+ \
         template< typename Fn, BOOST_PP_ENUM_PARAMS(n, typename A) > \
         fiber( std::size_t stack_size, Fn fn, BOOST_ENUM_FIBER_ARGS(n)) : \
                 info_base_( \
@@ -182,6 +119,24 @@
 
 #undef BOOST_FIBER_FIBER_CTOR
 
+ template< typename Fn >
+ explicit fiber( BOOST_RV_REF( Fn) fn) :
+ info_base_( make_info_( BOOST_FIBER_DEFAULT_STACKSIZE, fn) )
+ { init_(); }
+
+ template< typename Fn >
+ explicit fiber( std::size_t stack_size, BOOST_RV_REF( Fn) fn) :
+ info_base_( make_info_( stack_size, fn) )
+ { init_(); }
+
+ fiber( fiber const& other);
+
+ fiber & operator=( BOOST_COPY_ASSIGN_REF( fiber) other);
+
+ fiber( BOOST_RV_REF( fiber) other);
+
+ fiber & operator=( BOOST_RV_REF( fiber) other);
+
         typedef detail::info_base::ptr_t::unspecified_bool_type unspecified_bool_type;
 
         operator unspecified_bool_type() const;
@@ -263,17 +218,18 @@
 fiber make_fiber( std::size_t stack_size, Fn fn)
 { return fiber( stack_size, fn); }
 
-#define BOOST_FIBER_make_info_FUNCTION(z, n, unused) \
+#define BOOST_FIBER_MAKE_FIBER_FUNCTION(z, n, unused) \
 template< typename Fn, BOOST_PP_ENUM_PARAMS(n, typename A) > \
 fiber make_fiber( Fn fn, BOOST_ENUM_FIBER_ARGS(n)) \
 { return fiber( fn, BOOST_PP_ENUM_PARAMS(n, a) ); } \
+\
 template< typename Fn, BOOST_PP_ENUM_PARAMS(n, typename A) > \
 fiber make_fiber( std::size_t stack_size, Fn fn, BOOST_ENUM_FIBER_ARGS(n)) \
 { return fiber( stack_size, fn, BOOST_PP_ENUM_PARAMS(n, a) ); }
 
-BOOST_PP_REPEAT_FROM_TO( 1, BOOST_FIBER_MAX_ARITY, BOOST_FIBER_make_info_FUNCTION, ~)
+BOOST_PP_REPEAT_FROM_TO( 1, BOOST_FIBER_MAX_ARITY, BOOST_FIBER_MAKE_FIBER_FUNCTION, ~)
 
-#undef BOOST_FIBER_make_info_FUNCTION
+#undef BOOST_FIBER_MAKE_FIBER_FUNCTION
 #undef BOOST_ENUM_FIBER_ARGS
 #undef BOOST_FIBER_ARG
 #undef BOOST_FIBER_MAX_ARITY
@@ -285,18 +241,8 @@
 using fibers::fiber;
 
 inline
-void swap( fiber & lhs, fiber & rhs)
-{ return lhs.swap( rhs); }
-
-#ifdef BOOST_HAS_RVALUE_REFS
-inline
-fiber && move( fiber && f)
-{ return f; }
-#else
-inline
-fiber move( boost::detail::thread_move_t< fiber > f)
-{ return fiber( f); }
-#endif
+void swap( fiber & l, fiber & r)
+{ return l.swap( r); }
 
 }
 

Modified: sandbox/fiber/boost/fiber/scheduler.hpp
==============================================================================
--- sandbox/fiber/boost/fiber/scheduler.hpp (original)
+++ sandbox/fiber/boost/fiber/scheduler.hpp 2009-12-20 15:48:12 EST (Sun, 20 Dec 2009)
@@ -12,6 +12,7 @@
 
 #include <boost/preprocessor/repetition.hpp>
 #include <boost/intrusive_ptr.hpp>
+#include <boost/move/move.hpp>
 #include <boost/utility.hpp>
 
 #include <boost/fiber/detail/config.hpp>
@@ -78,9 +79,17 @@
         { strategy_->add( fiber( fn) ); }
 
         template< typename Fn >
+ void make_fiber( BOOST_RV_REF( Fn) fn)
+ { strategy_->add( fiber( fn) ); }
+
+ template< typename Fn >
         void make_fiber( std::size_t stack_size, Fn fn)
         { strategy_->add( fiber( stack_size, fn) ); }
 
+ template< typename Fn >
+ void make_fiber( std::size_t stack_size, BOOST_RV_REF( Fn) fn)
+ { strategy_->add( fiber( stack_size, fn) ); }
+
         void migrate_fiber( fiber f)
         {
                 if ( ! f) throw fiber_moved();

Modified: sandbox/fiber/boost/fiber/spin/future.hpp
==============================================================================
--- sandbox/fiber/boost/fiber/spin/future.hpp (original)
+++ sandbox/fiber/boost/fiber/spin/future.hpp 2009-12-20 15:48:12 EST (Sun, 20 Dec 2009)
@@ -16,11 +16,11 @@
 #include <boost/config.hpp>
 #include <boost/exception_ptr.hpp>
 #include <boost/function.hpp>
+#include <boost/move/move.hpp>
 #include <boost/next_prior.hpp>
 #include <boost/ref.hpp>
 #include <boost/scoped_array.hpp>
 #include <boost/shared_ptr.hpp>
-#include <boost/thread/detail/move.hpp>
 #include <boost/utility/enable_if.hpp>
 
 #include <boost/fiber/detail/future_traits.hpp>
@@ -473,10 +473,9 @@
 template <typename R>
 class unique_future
 {
- unique_future(unique_future & rhs);// = delete;
- unique_future& operator=(unique_future& rhs);// = delete;
-
     typedef boost::shared_ptr<detail::future_object<R> > future_ptr;
+
+ BOOST_MOVABLE_BUT_NOT_COPYABLE( unique_future);
     
     future_ptr future;
 
@@ -500,37 +499,19 @@
     ~unique_future()
     {}
 
-#ifdef BOOST_HAS_RVALUE_REFS
- unique_future(unique_future && other)
- {
- future.swap(other.future);
- }
- unique_future& operator=(unique_future && other)
+ unique_future( BOOST_RV_REF( unique_future) other):
+ future(other.future)
         {
- future=other.future;
             other.future.reset();
- return *this;
- }
-#else
- unique_future(boost::detail::thread_move_t<unique_future> other):
- future(other->future)
- {
- other->future.reset();
         }
         
- unique_future& operator=(boost::detail::thread_move_t<unique_future> other)
+ unique_future& operator=( BOOST_RV_REF( unique_future) other)
         {
- future=other->future;
- other->future.reset();
+ future=other.future;
+ other.future.reset();
             return *this;
         }
         
- operator boost::detail::thread_move_t<unique_future>()
- {
- return boost::detail::thread_move_t<unique_future>(*this);
- }
-#endif
-
         void swap(unique_future& other)
         {
             future.swap(other.future);
@@ -587,12 +568,11 @@
 class shared_future
 {
     typedef boost::shared_ptr<detail::future_object<R> > future_ptr;
+
+ BOOST_COPYABLE_AND_MOVABLE( shared_future);
     
     future_ptr future;
 
-// shared_future(const unique_future<R>& other);
-// shared_future& operator=(const unique_future<R>& other);
-
         friend class detail::future_waiter;
         friend class promise<R>;
         friend class packaged_task<R>;
@@ -614,64 +594,35 @@
         ~shared_future()
         {}
         
- shared_future& operator=(shared_future const& other)
+ shared_future& operator=( BOOST_COPY_ASSIGN_REF( shared_future) other)
         {
             future=other.future;
             return *this;
         }
-#ifdef BOOST_HAS_RVALUE_REFS
- shared_future(shared_future && other)
+
+ shared_future( BOOST_RV_REF( shared_future) other):
+ future(other.future)
         {
- future.swap(other.future);
+ other->future.reset();
         }
- shared_future(unique_future<R> && other)
+ shared_future( BOOST_RV_REF( unique_future<R>) other):
+ future(other.future)
         {
- future.swap(other.future);
+ other.future.reset();
         }
- shared_future& operator=(shared_future && other)
+ shared_future& operator=(BOOST_RV_REF( shared_future) other)
         {
             future.swap(other.future);
             other.future.reset();
             return *this;
         }
- shared_future& operator=(unique_future<R> && other)
+ shared_future& operator=( BOOST_RV_REF( unique_future<R>) other)
         {
             future.swap(other.future);
             other.future.reset();
             return *this;
         }
-#else
- shared_future(boost::detail::thread_move_t<shared_future> other):
- future(other->future)
- {
- other->future.reset();
- }
-// shared_future(const unique_future<R> &) = delete;
- shared_future(boost::detail::thread_move_t<unique_future<R> > other):
- future(other->future)
- {
- other->future.reset();
- }
- shared_future& operator=(boost::detail::thread_move_t<shared_future> other)
- {
- future.swap(other->future);
- other->future.reset();
- return *this;
- }
- shared_future& operator=(boost::detail::thread_move_t<unique_future<R> > other)
- {
- future.swap(other->future);
- other->future.reset();
- return *this;
- }
         
- operator boost::detail::thread_move_t<shared_future>()
- {
- return boost::detail::thread_move_t<shared_future>(*this);
- }
-
-#endif
-
         void swap(shared_future& other)
         {
             future.swap(other.future);
@@ -728,13 +679,12 @@
 class promise
 {
     typedef boost::shared_ptr<detail::future_object<R> > future_ptr;
+
+ BOOST_MOVABLE_BUT_NOT_COPYABLE( promise);
     
     future_ptr future;
     bool future_obtained;
     
- promise(promise & rhs);// = delete;
- promise & operator=(promise & rhs);// = delete;
-
     void lazy_init()
     {
         if(!future)
@@ -764,39 +714,18 @@
             }
         }
         
- // Assignment
-#ifdef BOOST_HAS_RVALUE_REFS
- promise(promise && rhs):
- future_obtained(rhs.future_obtained)
+ promise( BOOST_RV_REF( promise) rhs):
+ future(rhs.future),future_obtained(rhs.future_obtained)
         {
- future.swap(rhs.future);
+ rhs.future.reset();
         }
- promise & operator=(promise&& rhs)
+ promise & operator=( BOOST_RV_REF( promise) rhs)
         {
- future.swap(rhs.future);
+ future=rhs.future;
             future_obtained=rhs.future_obtained;
             rhs.future.reset();
             return *this;
         }
-#else
- promise(boost::detail::thread_move_t<promise> rhs):
- future(rhs->future),future_obtained(rhs->future_obtained)
- {
- rhs->future.reset();
- }
- promise & operator=(boost::detail::thread_move_t<promise> rhs)
- {
- future=rhs->future;
- future_obtained=rhs->future_obtained;
- rhs->future.reset();
- return *this;
- }
-
- operator boost::detail::thread_move_t<promise>()
- {
- return boost::detail::thread_move_t<promise>(*this);
- }
-#endif
         
         void swap(promise& other)
         {
@@ -863,13 +792,12 @@
 class promise<void>
 {
     typedef boost::shared_ptr<detail::future_object<void> > future_ptr;
+
+ BOOST_MOVABLE_BUT_NOT_COPYABLE( promise);
     
     future_ptr future;
     bool future_obtained;
     
- promise(promise & rhs);// = delete;
- promise & operator=(promise & rhs);// = delete;
-
     void lazy_init()
     {
         if(!future)
@@ -879,8 +807,6 @@
         }
     }
 public:
-// template <class Allocator> explicit promise(Allocator a);
-
         promise():
             future(),future_obtained(false)
         {}
@@ -898,39 +824,18 @@
             }
         }
         
- // Assignment
-#ifdef BOOST_HAS_RVALUE_REFS
- promise(promise && rhs):
- future_obtained(rhs.future_obtained)
+ promise( BOOST_RV_REF( promise) rhs):
+ future(rhs.future),future_obtained(rhs.future_obtained)
         {
- future.swap(rhs.future);
+ rhs.future.reset();
         }
- promise & operator=(promise&& rhs)
+ promise & operator=( BOOST_RV_REF( promise) rhs)
         {
- future.swap(rhs.future);
+ future=rhs.future;
             future_obtained=rhs.future_obtained;
             rhs.future.reset();
             return *this;
         }
-#else
- promise(boost::detail::thread_move_t<promise> rhs):
- future(rhs->future),future_obtained(rhs->future_obtained)
- {
- rhs->future.reset();
- }
- promise & operator=(boost::detail::thread_move_t<promise> rhs)
- {
- future=rhs->future;
- future_obtained=rhs->future_obtained;
- rhs->future.reset();
- return *this;
- }
-
- operator boost::detail::thread_move_t<promise>()
- {
- return boost::detail::thread_move_t<promise>(*this);
- }
-#endif
         
         void swap(promise& other)
         {
@@ -1029,7 +934,7 @@
     task_object(F const& f_):
         f(f_)
     {}
- task_object(boost::detail::thread_move_t<F> f_):
+ task_object( BOOST_RV_REF( F) f_):
         f(f_)
     {}
     
@@ -1054,7 +959,7 @@
     task_object(F const& f_):
         f(f_)
     {}
- task_object(boost::detail::thread_move_t<F> f_):
+ task_object( BOOST_RV_REF( F) f_):
         f(f_)
     {}
     
@@ -1078,11 +983,10 @@
 template<typename R>
 class packaged_task
 {
+ BOOST_MOVABLE_BUT_NOT_COPYABLE( packaged_task);
+
     boost::shared_ptr<detail::task_base<R> > task;
     bool future_obtained;
-
- packaged_task(packaged_task&);// = delete;
- packaged_task& operator=(packaged_task&);// = delete;
     
 public:
     packaged_task():
@@ -1099,7 +1003,7 @@
     {}
     
     template <class F>
- explicit packaged_task(boost::detail::thread_move_t<F> f):
+ explicit packaged_task( BOOST_RV_REF( F) f):
         task(new detail::task_object<R,F>(f)),future_obtained(false)
     {}
 
@@ -1117,38 +1021,18 @@
             }
         }
 
- // assignment
-#ifdef BOOST_HAS_RVALUE_REFS
- packaged_task(packaged_task&& other):
+ packaged_task( BOOST_RV_REF( packaged_task) other):
             future_obtained(other.future_obtained)
         {
             task.swap(other.task);
             other.future_obtained=false;
         }
- packaged_task& operator=(packaged_task&& other)
- {
- packaged_task temp(static_cast<packaged_task&&>(other));
- swap(temp);
- return *this;
- }
-#else
- packaged_task(boost::detail::thread_move_t<packaged_task> other):
- future_obtained(other->future_obtained)
- {
- task.swap(other->task);
- other->future_obtained=false;
- }
- packaged_task& operator=(boost::detail::thread_move_t<packaged_task> other)
+ packaged_task& operator=( BOOST_RV_REF( packaged_task) other)
         {
             packaged_task temp(other);
             swap(temp);
             return *this;
         }
- operator boost::detail::thread_move_t<packaged_task>()
- {
- return boost::detail::thread_move_t<packaged_task>(*this);
- }
-#endif
         
         void swap(packaged_task& other)
         {

Modified: sandbox/fiber/change.log
==============================================================================
--- sandbox/fiber/change.log (original)
+++ sandbox/fiber/change.log 2009-12-20 15:48:12 EST (Sun, 20 Dec 2009)
@@ -1,8 +1,13 @@
+0.3.2:
+------
+- default stacksize = 64kB because of seg fault if value is too small
+- using boost.move library for move support
+
 0.3.1:
 ------
 - scheduler< Strategy >::migrate_fiber() overloaded - passing only fiber to be migrated
-- default stacksize set to 8kB
-- documetnation updated
+- documentation updated
+- default stacksize = 8kB
 
 0.3.0:
 ------

Modified: sandbox/fiber/libs/fiber/src/fiber.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/src/fiber.cpp (original)
+++ sandbox/fiber/libs/fiber/src/fiber.cpp 2009-12-20 15:48:12 EST (Sun, 20 Dec 2009)
@@ -18,15 +18,6 @@
 namespace boost {
 namespace fibers {
 
-#ifdef BOOST_HAS_RVALUE_REFS
-detail::info_base::ptr_t
-fiber::make_info_( std::size_t stack_size, void ( * fn)() )
-{
- return detail::info_base::ptr_t(
- new detail::info< void( *)() >( fn, stack_size) );
-}
-#endif
-
 fiber::fiber() :
         info_base_()
 {}
@@ -35,47 +26,32 @@
         info_base_( info_base)
 {}
 
-#ifdef BOOST_HAS_RVALUE_REFS
-fiber::fiber( fiber && other)
-{ info_base_.swap( other.info_base_); }
+fiber::fiber( fiber const& other) :
+ info_base_( other.info_base_)
+{}
 
 fiber &
-fiber::operator=( fiber && other)
+fiber::operator=( BOOST_COPY_ASSIGN_REF( fiber) other)
 {
+ if ( this == & other) return * this;
         info_base_ = other.info_base_;
- other.info_base_.reset();
         return * this;
 }
 
-fiber &&
-fiber::move()
-{ return static_cast< fiber && >( * this); }
-#else
-fiber::fiber( boost::detail::thread_move_t< fiber > f)
+fiber::fiber( BOOST_RV_REF( fiber) other)
 {
- info_base_ = f->info_base_;
- f->info_base_.reset();
+ info_base_ = other.info_base_;
+ other.info_base_.reset();
 }
 
 fiber &
-fiber::operator=( boost::detail::thread_move_t< fiber > f)
+fiber::operator=( BOOST_RV_REF( fiber) other)
 {
- fiber new_fiber( f);
- swap( new_fiber);
+ fiber tmp( other);
+ swap( tmp);
         return * this;
 }
 
-fiber::operator boost::detail::thread_move_t< fiber >()
-{ return move(); }
-
-boost::detail::thread_move_t< fiber >
-fiber::move()
-{
- boost::detail::thread_move_t< fiber > f( * this);
- return f;
-}
-#endif
-
 detail::info_base::ptr_t
 fiber::info_() const
 { return info_base_; }

Modified: sandbox/fiber/libs/fiber/test/test_spin_future.cpp
==============================================================================
--- sandbox/fiber/libs/fiber/test/test_spin_future.cpp (original)
+++ sandbox/fiber/libs/fiber/test/test_spin_future.cpp 2009-12-20 15:48:12 EST (Sun, 20 Dec 2009)
@@ -9,28 +9,21 @@
 #include <memory>
 #include <string>
 
+#include <boost/move/move.hpp>
 #include <boost/test/unit_test.hpp>
 
-#ifdef BOOST_HAS_RVALUE_REFS
- template<typename T>
- typename boost::remove_reference<T>::type&& cast_to_rval(T&& t)
- {
- return t;
- }
-#else
- template<typename T>
- boost::detail::thread_move_t<T> cast_to_rval(T& t)
- {
- return boost::move(t);
- }
-#endif
+template<typename T>
+BOOST_RV_REF( T) cast_to_rval(T& t)
+{
+ return boost::move(t);
+}
 
 struct X
 {
 private:
     
- X(X& other);
-
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(X);
+
 public:
     
     int i;
@@ -38,23 +31,11 @@
     X():
         i(42)
     {}
-#ifdef BOOST_HAS_RVALUE_REFS
- X(X&& other):
+ X( BOOST_RV_REF( X) other):
         i(other.i)
     {
         other.i=0;
     }
-#else
- X(boost::detail::thread_move_t<X> other):
- i(other->i)
- {
- other->i=0;
- }
- operator boost::detail::thread_move_t<X>()
- {
- return boost::detail::thread_move_t<X>(*this);
- }
-#endif
     ~X()
     {}
 };


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