From abe114ad817bfc650e9999eb9d2b88b7d749147f Mon Sep 17 00:00:00 2001 From: Oliver Kowalke Date: Sun, 18 Oct 2015 19:21:45 +0200 Subject: [PATCH] segmented-stacks=on -> only segmented_stack is available --- doc/stack.qbk | 3 +++ include/boost/fiber/context.hpp | 3 ++- include/boost/fiber/fiber.hpp | 3 ++- include/boost/fiber/fixedsize_stack.hpp | 3 +++ include/boost/fiber/segmented_stack.hpp | 3 ++- src/context.cpp | 4 ++-- 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/doc/stack.qbk b/doc/stack.qbk index c03c8e13..a53ff4c0 100644 --- a/doc/stack.qbk +++ b/doc/stack.qbk @@ -92,4 +92,7 @@ __segmented_stack__, __boost_fiber__ must be built with property `segmented-stacks`, e.g. [*toolset=gcc segmented-stacks=on] at b2/bjam command line.] +[note If the library is compiled for segmented stacks, __segmented_stack__ is the only +available stack allocator.] + [endsect] diff --git a/include/boost/fiber/context.hpp b/include/boost/fiber/context.hpp index 3b9f4e9a..65eff396 100644 --- a/include/boost/fiber/context.hpp +++ b/include/boost/fiber/context.hpp @@ -30,6 +30,7 @@ #include #include #include +#include #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX @@ -259,7 +260,7 @@ public: // dispatcher fiber context context( dispatcher_context_t, boost::context::preallocated const&, - fixedsize_stack const&, scheduler *); + default_stack const&, scheduler *); // worker fiber context template< typename StackAlloc, typename Fn, typename ... Args > diff --git a/include/boost/fiber/fiber.hpp b/include/boost/fiber/fiber.hpp index 40297648..6ece8064 100644 --- a/include/boost/fiber/fiber.hpp +++ b/include/boost/fiber/fiber.hpp @@ -20,6 +20,7 @@ #include #include #include +#include #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX @@ -47,7 +48,7 @@ public: template< typename Fn, typename ... Args > explicit fiber( Fn && fn, Args && ... args) : - fiber( std::allocator_arg, fixedsize_stack(), + fiber( std::allocator_arg, default_stack(), std::forward< Fn >( fn), std::forward< Args >( args) ... ) { } diff --git a/include/boost/fiber/fixedsize_stack.hpp b/include/boost/fiber/fixedsize_stack.hpp index 54dc2a60..22569267 100644 --- a/include/boost/fiber/fixedsize_stack.hpp +++ b/include/boost/fiber/fixedsize_stack.hpp @@ -20,6 +20,9 @@ namespace boost { namespace fibers { typedef boost::context::fixedsize_stack fixedsize_stack; +#if !defined(BOOST_USE_SEGMENTED_STACKS) +typedef boost::context::default_stack default_stack; +#endif }} diff --git a/include/boost/fiber/segmented_stack.hpp b/include/boost/fiber/segmented_stack.hpp index a5c92867..a9232b95 100644 --- a/include/boost/fiber/segmented_stack.hpp +++ b/include/boost/fiber/segmented_stack.hpp @@ -21,7 +21,8 @@ namespace fibers { #if defined(BOOST_USE_SEGMENTED_STACKS) # if ! defined(BOOST_WINDOWS) -typedef boost::context::segmented_stack segmented_stack; +typedef boost::context::segmented_stack segmented_stack; +typedef boost::context::default_stack default_stack; # endif #endif diff --git a/src/context.cpp b/src/context.cpp index 9268ed52..6d80434f 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -27,7 +27,7 @@ context::active_; static intrusive_ptr< context > make_dispatcher_context( scheduler * sched) { BOOST_ASSERT( nullptr != sched); - fixedsize_stack salloc; // use default satck-size + default_stack salloc; // use default satck-size boost::context::stack_context sctx = salloc.allocate(); #if defined(BOOST_NO_CXX14_CONSTEXPR) || defined(BOOST_NO_CXX11_STD_ALIGN) // reserve space for control structure @@ -173,7 +173,7 @@ context::context( main_context_t) : // dispatcher fiber context context::context( dispatcher_context_t, boost::context::preallocated const& palloc, - fixedsize_stack const& salloc, scheduler * sched) : + default_stack const& salloc, scheduler * sched) : use_count_( 0), // scheduler will own dispatcher context flags_( flag_dispatcher_context), scheduler_( nullptr),