diff --git a/doc/coro.qbk b/doc/coro.qbk index bb0d5cc..9192ac7 100644 --- a/doc/coro.qbk +++ b/doc/coro.qbk @@ -53,6 +53,7 @@ [def __getline__ ['std::getline()]] [def __handle_read__ ['session::handle_read()]] [def __io_service__ ['boost::asio::io_sevice]] +[def __pooled_fixedsize__ ['pooled_fixedsize_stack]] [def __protected_allocator__ ['protected_fixedsize]] [def __protected_fixedsize__ ['protected_fixedsize_stack]] [def __pull_coro__ ['coroutine<>::pull_type]] diff --git a/doc/stack.qbk b/doc/stack.qbk index 9bb6a51..3497f3c 100644 --- a/doc/stack.qbk +++ b/doc/stack.qbk @@ -95,25 +95,25 @@ the highest/lowest address of the stack.]] [endsect] -[section:fixedsize Class ['fixedsize_stack]] +[section:pooled_fixedsize Class ['pooled_fixedsize_stack]] -__boost_coroutine__ provides the class __fixedsize__ which models +__boost_coroutine__ provides the class __pooled_fixedsize__ which models the __stack_allocator_concept__. -In contrast to __protected_fixedsize__ it does not append a guard page at the +In contrast to __pooled_fixedsize__ it does not append a guard page at the end of each stack. The memory is managed internally by [@http://www.boost.org/doc/libs/release/libs/pool/doc/html/boost/pool.html `boost::pool<>`]. - #include + #include - struct fixedsize_stack { - fixesize_stack(std::size_t size = traits_type::default_size()); + struct pooled_fixedsize_stack { + pooled_fixedsize_stack(std::size_t size = traits_type::default_size()); stack_context allocate(); void deallocate( stack_context &); } -[heading `fixesize_stack(std::size_t stack_size, std::size_t next_size, std::size_t max_size)] +[heading `pooled_fixedsize_stack(std::size_t stack_size, std::size_t next_size, std::size_t max_size)`] [variablelist [[Preconditions:] [`! traits_type::is_unbounded() && ( traits_type::maximum:size() >= stack_size)` and `0 < nest_size`.]] @@ -145,6 +145,44 @@ address of the stack.]] [endsect] +[section:fixedsize Class ['fixedsize_stack]] + +__boost_coroutine__ provides the class __fixedsize__ which models +the __stack_allocator_concept__. +In contrast to __protected_fixedsize__ it does not append a guard page at the +end of each stack. The memory is simply managed by `std::malloc()` and +`std::free()`. + + #include + + struct fixedsize_stack { + fixedsize_stack(std::size_t size = traits_type::default_size()); + + stack_context allocate(); + + void deallocate( stack_context &); + } + +[heading `stack_context allocate()`] +[variablelist +[[Preconditions:] [`traits_type::minimum:size() <= size` and +`! traits_type::is_unbounded() && ( traits_type::maximum:size() >= size)`.]] +[[Effects:] [Allocates memory of at least `size` Bytes and stores a pointer to +the stack and its actual size in `sctx`. Depending on the architecture (the +stack grows downwards/upwards) the stored address is the highest/lowest +address of the stack.]] +] + +[heading `void deallocate( stack_context & sctx)`] +[variablelist +[[Preconditions:] [`sctx.sp` is valid, `traits_type::minimum:size() <= sctx.size` and +`! traits_type::is_unbounded() && ( traits_type::maximum:size() >= sctx.size)`.]] +[[Effects:] [Deallocates the stack space.]] +] + +[endsect] + + [section:segmented Class ['segmented_stack]] __boost_coroutine__ supports usage of a __segmented__, e. g. the size of