mirror of
https://github.com/boostorg/coroutine2.git
synced 2025-05-11 13:34:08 +00:00
fix docu for stacks
This commit is contained in:
parent
749dba0834
commit
6cb67bc941
@ -67,20 +67,14 @@ virtual addresses are used.]
|
|||||||
|
|
||||||
#include <boost/coroutine2/protected_fixedsize.hpp>
|
#include <boost/coroutine2/protected_fixedsize.hpp>
|
||||||
|
|
||||||
template< typename traitsT >
|
struct protected_fixedsize {
|
||||||
struct basic_protected_fixedsize
|
protected_fixesize(std::size_t size = traits_type::default_size());
|
||||||
{
|
|
||||||
typedef traitT traits_type;
|
|
||||||
|
|
||||||
basic_protected_fixesize(std::size_t size = traits_type::default_size());
|
|
||||||
|
|
||||||
stack_context allocate();
|
stack_context allocate();
|
||||||
|
|
||||||
void deallocate( stack_context &);
|
void deallocate( stack_context &);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef basic_protected_fixedsize< stack_traits > protected_fixedsize
|
|
||||||
|
|
||||||
[heading `stack_context allocate()`]
|
[heading `stack_context allocate()`]
|
||||||
[variablelist
|
[variablelist
|
||||||
[[Preconditions:] [`traits_type::minimum:size() <= size` and
|
[[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
|
__boost_coroutine__ provides the class __fixedsize__ which models
|
||||||
the __stack_allocator_concept__.
|
the __stack_allocator_concept__.
|
||||||
In contrast to __protected_fixedsize__ it does not append a guard page at the
|
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
|
end of each stack. The memory is managed internally by
|
||||||
`std::free()`.
|
[@http://www.boost.org/doc/libs/release/libs/pool/doc/html/boost/pool.html `boost::pool<>`].
|
||||||
|
|
||||||
#include <boost/coroutine2/fixedsize_stack.hpp>
|
#include <boost/coroutine2/fixedsize_stack.hpp>
|
||||||
|
|
||||||
template< typename traitsT >
|
struct fixedsize_stack {
|
||||||
struct basic_fixedsize_stack
|
fixesize_stack(std::size_t size = traits_type::default_size());
|
||||||
{
|
|
||||||
typedef traitT traits_type;
|
|
||||||
|
|
||||||
basic_fixesize_stack(std::size_t size = traits_type::default_size());
|
|
||||||
|
|
||||||
stack_context allocate();
|
stack_context allocate();
|
||||||
|
|
||||||
void deallocate( stack_context &);
|
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()`]
|
[heading `stack_context allocate()`]
|
||||||
[variablelist
|
[variablelist
|
||||||
[[Preconditions:] [`traits_type::minimum:size() <= size` and
|
[[Preconditions:] [`! traits_type::is_unbounded() && ( traits_type::maximum:size() >= size)`.]]
|
||||||
`! traits_type::is_unbounded() && ( traits_type::maximum:size() >= size)`.]]
|
|
||||||
[[Effects:] [Allocates memory of at least `size` bytes and stores a pointer to
|
[[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
|
the stack and its actual size in `sctx`. Depending on the architecture (the
|
||||||
stack grows downwards/upwards) the stored address is the highest/lowest
|
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)`]
|
[heading `void deallocate( stack_context & sctx)`]
|
||||||
[variablelist
|
[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)`.]]
|
`! traits_type::is_unbounded() && ( traits_type::maximum:size() >= sctx.size)`.]]
|
||||||
[[Effects:] [Deallocates the stack space.]]
|
[[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
|
[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
|
[*4.7] and [*clang] from version [*3.4] onwards. In order to use a
|
||||||
__segmented_stack__ __boost_coroutine__ must be built with
|
__segmented_stack__ __boost_coroutine__ must be built with
|
||||||
[*toolset=gcc segmented-stacks=on] at b2/bjam command-line. Applications
|
property `segmented-stacks`, e.g. [*toolset=gcc segmented-stacks=on] at b2/bjam
|
||||||
must be compiled with compiler-flags
|
command line.]
|
||||||
[*-fsplit-stack -DBOOST_USE_SEGMENTED_STACKS].]
|
|
||||||
|
|
||||||
#include <boost/coroutine2/segmented_stack.hpp>
|
#include <boost/coroutine2/segmented_stack.hpp>
|
||||||
|
|
||||||
template< typename traitsT >
|
struct segmented_stack {
|
||||||
struct basic_segmented_stack
|
segmented_stack(std::size_t size = traits_type::default_size());
|
||||||
{
|
|
||||||
typedef traitT traits_type;
|
|
||||||
|
|
||||||
basic_segmented_stack(std::size_t size = traits_type::default_size());
|
|
||||||
|
|
||||||
stack_context allocate();
|
stack_context allocate();
|
||||||
|
|
||||||
void deallocate( stack_context &);
|
void deallocate( stack_context &);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef basic_segmented_stack< stack_traits > segmented_stack;
|
|
||||||
|
|
||||||
[heading `stack_context allocate()`]
|
[heading `stack_context allocate()`]
|
||||||
[variablelist
|
[variablelist
|
||||||
[[Preconditions:] [`traits_type::minimum:size() <= size` and
|
[[Preconditions:] [`traits_type::minimum:size() <= size` and
|
||||||
|
Loading…
x
Reference in New Issue
Block a user