diff --git a/include/boost/fiber/round_robin.hpp b/include/boost/fiber/round_robin.hpp index 07ebb7aa..b9443cad 100644 --- a/include/boost/fiber/round_robin.hpp +++ b/include/boost/fiber/round_robin.hpp @@ -77,6 +77,8 @@ private: rqueue_t rqueue_; detail::main_fiber mn_; + void resume_( detail::worker_fiber::ptr_t const&); + public: round_robin() BOOST_NOEXCEPT; diff --git a/performance/preallocated_stack_allocator.hpp b/performance/preallocated_stack_allocator.hpp index a2db1436..47750321 100644 --- a/performance/preallocated_stack_allocator.hpp +++ b/performance/preallocated_stack_allocator.hpp @@ -14,7 +14,7 @@ #include #include -#include +#include #include #include #include @@ -33,7 +33,9 @@ public: stack_ctx_() { boost::coroutines::standard_stack_allocator allocator; - allocator.allocate( stack_ctx_, default_stacksize() ); + allocator.allocate( + stack_ctx_, + boost::coroutines::stack_allocator::traits_type::default_size() ); } void allocate( boost::coroutines::stack_context & ctx, std::size_t size) @@ -45,15 +47,6 @@ public: void deallocate( boost::coroutines::stack_context & ctx) { } - - static std::size_t maximum_stacksize() - { return boost::coroutines::standard_stack_allocator::maximum_stacksize(); } - - static std::size_t default_stacksize() - { return boost::coroutines::standard_stack_allocator::default_stacksize(); } - - static std::size_t minimum_stacksize() - { return boost::coroutines::standard_stack_allocator::minimum_stacksize(); } }; #ifdef BOOST_HAS_ABI_HEADERS diff --git a/src/round_robin.cpp b/src/round_robin.cpp index a02575a7..f8e16152 100644 --- a/src/round_robin.cpp +++ b/src/round_robin.cpp @@ -28,26 +28,8 @@ namespace boost { namespace fibers { -round_robin::round_robin() BOOST_NOEXCEPT : - active_fiber_(), - wqueue_(), - rqueue_(), - mn_() -{} - -round_robin::~round_robin() BOOST_NOEXCEPT -{ - // fibers will be destroyed (stack-unwinding) - // if last reference goes out-of-scope - // therefore destructing wqueue_ && rqueue_ - // will destroy the fibers in this scheduler - // if not referenced on other places - while ( ! wqueue_.empty() && ! rqueue_.empty() ) - run(); -} - void -round_robin::spawn( detail::worker_fiber::ptr_t const& f) +round_robin::resume_( detail::worker_fiber::ptr_t const& f) { BOOST_ASSERT( f); BOOST_ASSERT( f->is_ready() ); @@ -67,6 +49,27 @@ round_robin::spawn( detail::worker_fiber::ptr_t const& f) active_fiber_ = tmp; } +round_robin::round_robin() BOOST_NOEXCEPT : + active_fiber_(), + wqueue_(), + rqueue_(), + mn_() +{} + +round_robin::~round_robin() BOOST_NOEXCEPT +{ + // fibers will be destroyed (stack-unwinding) + // if last reference goes out-of-scope + // therefore destructing wqueue_ && rqueue_ + // will destroy the fibers in this scheduler + // if not referenced on other places + while ( ! wqueue_.empty() && ! rqueue_.empty() ) + run(); +} +void +round_robin::spawn( detail::worker_fiber::ptr_t const& f) +{ rqueue_.push_back( f); } + bool round_robin::run() { @@ -109,7 +112,7 @@ round_robin::run() while ( true); // resume fiber - spawn( f); + resume_( f); return true; }