fix docu for stacks

This commit is contained in:
Oliver Kowalke 2016-02-27 20:26:51 +01:00
parent 749dba0834
commit 6cb67bc941

View File

@ -67,20 +67,14 @@ virtual addresses are used.]
#include <boost/coroutine2/protected_fixedsize.hpp>
template< typename traitsT >
struct basic_protected_fixedsize
{
typedef traitT traits_type;
basic_protected_fixesize(std::size_t size = traits_type::default_size());
struct protected_fixedsize {
protected_fixesize(std::size_t size = traits_type::default_size());
stack_context allocate();
void deallocate( stack_context &);
}
typedef basic_protected_fixedsize< stack_traits > protected_fixedsize
[heading `stack_context allocate()`]
[variablelist
[[Preconditions:] [`traits_type::minimum:size() <= size` and
@ -106,29 +100,35 @@ the highest/lowest address of the 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()`.
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 <boost/coroutine2/fixedsize_stack.hpp>
template< typename traitsT >
struct basic_fixedsize_stack
{
typedef traitT traits_type;
basic_fixesize_stack(std::size_t size = traits_type::default_size());
struct fixedsize_stack {
fixesize_stack(std::size_t size = traits_type::default_size());
stack_context allocate();
void deallocate( stack_context &);
}
typedef basic_fixedsize_stack< stack_traits > fixedsize_stack;
[heading `fixesize_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`.]]
[[Effects:] [Allocates memory of at least `stack_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. Argument `next_size` determines the number of stacks to
request from the system the first time that `*this` needs to allocate system
memory. The third argument `max_size` controls how many memory might be
allocated for stacks - a value of zero means no uper limit.]]
]
[heading `stack_context allocate()`]
[variablelist
[[Preconditions:] [`traits_type::minimum:size() <= size` and
`! traits_type::is_unbounded() && ( traits_type::maximum:size() >= size)`.]]
[[Preconditions:] [`! 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
@ -137,7 +137,7 @@ address of the stack.]]
[heading `void deallocate( stack_context & sctx)`]
[variablelist
[[Preconditions:] [`sctx.sp` is valid, `traits_type::minimum:size() <= sctx.size` and
[[Preconditions:] [`sctx.sp` is valid,
`! traits_type::is_unbounded() && ( traits_type::maximum:size() >= sctx.size)`.]]
[[Effects:] [Deallocates the stack space.]]
]
@ -157,26 +157,19 @@ stack which grows on demand.
[note Segmented stacks are currently only supported by [*gcc] from version
[*4.7] and [*clang] from version [*3.4] onwards. In order to use a
__segmented_stack__ __boost_coroutine__ must be built with
[*toolset=gcc segmented-stacks=on] at b2/bjam command-line. Applications
must be compiled with compiler-flags
[*-fsplit-stack -DBOOST_USE_SEGMENTED_STACKS].]
property `segmented-stacks`, e.g. [*toolset=gcc segmented-stacks=on] at b2/bjam
command line.]
#include <boost/coroutine2/segmented_stack.hpp>
template< typename traitsT >
struct basic_segmented_stack
{
typedef traitT traits_type;
basic_segmented_stack(std::size_t size = traits_type::default_size());
struct segmented_stack {
segmented_stack(std::size_t size = traits_type::default_size());
stack_context allocate();
void deallocate( stack_context &);
}
typedef basic_segmented_stack< stack_traits > segmented_stack;
[heading `stack_context allocate()`]
[variablelist
[[Preconditions:] [`traits_type::minimum:size() <= size` and