]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/context/doc/html/context/econtext/stack/segmented.html
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / context / doc / html / context / econtext / stack / segmented.html
CommitLineData
7c673cae
FG
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4<title>Class segmented</title>
5<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
7<link rel="home" href="../../../index.html" title="Chapter&#160;1.&#160;Context">
8<link rel="up" href="../stack.html" title="Stack allocation">
9<link rel="prev" href="fixedsize.html" title="Class fixedsize">
10<link rel="next" href="stack_traits.html" title="Class stack_traits">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="fixedsize.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../stack.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="stack_traits.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h4 class="title">
27<a name="context.econtext.stack.segmented"></a><a class="link" href="segmented.html" title="Class segmented">Class <span class="emphasis"><em>segmented</em></span></a>
28</h4></div></div></div>
29<p>
30 <span class="bold"><strong>Boost.Context</strong></span> supports usage of a <span class="emphasis"><em>segmented</em></span>,
31 e. g. the size of the stack grows on demand. The coroutine is created with
32 a minimal stack size and will be increased as required. Class <span class="emphasis"><em>segmented</em></span>
33 models the <span class="emphasis"><em>stack-allocator concept</em></span>. In contrast to
34 <span class="emphasis"><em>protected_fixedsize</em></span> and <span class="emphasis"><em>fixedsize</em></span>
35 it creates a stack which grows on demand.
36 </p>
37<div class="note"><table border="0" summary="Note">
38<tr>
39<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../doc/src/images/note.png"></td>
40<th align="left">Note</th>
41</tr>
42<tr><td align="left" valign="top"><p>
43 Segmented stacks are currently only supported by <span class="bold"><strong>gcc</strong></span>
44 from version <span class="bold"><strong>4.7</strong></span> <span class="bold"><strong>clang</strong></span>
45 from version <span class="bold"><strong>3.4</strong></span> onwards. In order to
46 use a __segmented_stack__ <span class="bold"><strong>Boost.Context</strong></span>
47 must be built with <span class="bold"><strong>toolset=gcc segmented-stacks=on</strong></span>
48 at b2/bjam command-line. Applications must be compiled with compiler-flags
49 <span class="bold"><strong>-fsplit-stack -DBOOST_USE_SEGMENTED_STACKS</strong></span>.
50 </p></td></tr>
51</table></div>
52<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">context</span><span class="special">/</span><span class="identifier">segmented</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
53
54<span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">traitsT</span> <span class="special">&gt;</span>
55<span class="keyword">struct</span> <span class="identifier">basic_segmented</span>
56<span class="special">{</span>
57 <span class="keyword">typedef</span> <span class="identifier">traitT</span> <span class="identifier">traits_type</span><span class="special">;</span>
58
59 <span class="identifier">basic_segmented</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">size</span> <span class="special">=</span> <span class="identifier">traits_type</span><span class="special">::</span><span class="identifier">default_size</span><span class="special">());</span>
60
61 <span class="identifier">stack_context</span> <span class="identifier">allocate</span><span class="special">();</span>
62
63 <span class="keyword">void</span> <span class="identifier">deallocate</span><span class="special">(</span> <span class="identifier">stack_context</span> <span class="special">&amp;);</span>
64<span class="special">}</span>
65
66<span class="keyword">typedef</span> <span class="identifier">basic_segmented</span><span class="special">&lt;</span> <span class="identifier">stack_traits</span> <span class="special">&gt;</span> <span class="identifier">segmented</span><span class="special">;</span>
67</pre>
68<h6>
69<a name="context.econtext.stack.segmented.h0"></a>
70 <span><a name="context.econtext.stack.segmented._code__phrase_role__identifier__stack_context__phrase___phrase_role__identifier__allocate__phrase__phrase_role__special______phrase___code_"></a></span><a class="link" href="segmented.html#context.econtext.stack.segmented._code__phrase_role__identifier__stack_context__phrase___phrase_role__identifier__allocate__phrase__phrase_role__special______phrase___code_"><code class="computeroutput"><span class="identifier">stack_context</span> <span class="identifier">allocate</span><span class="special">()</span></code></a>
71 </h6>
72<div class="variablelist">
73<p class="title"><b></b></p>
74<dl>
75<dt><span class="term">Preconditions:</span></dt>
76<dd><p>
77 <code class="computeroutput"><span class="identifier">traits_type</span><span class="special">::</span><span class="identifier">minimum</span><span class="special">:</span><span class="identifier">size</span><span class="special">()</span>
78 <span class="special">&lt;=</span> <span class="identifier">size</span></code>
79 and <code class="computeroutput"><span class="special">!</span> <span class="identifier">traits_type</span><span class="special">::</span><span class="identifier">is_unbounded</span><span class="special">()</span> <span class="special">&amp;&amp;</span>
80 <span class="special">(</span> <span class="identifier">traits_type</span><span class="special">::</span><span class="identifier">maximum</span><span class="special">:</span><span class="identifier">size</span><span class="special">()</span> <span class="special">&gt;=</span>
81 <span class="identifier">size</span><span class="special">)</span></code>.
82 </p></dd>
83<dt><span class="term">Effects:</span></dt>
84<dd><p>
85 Allocates memory of at least <code class="computeroutput"><span class="identifier">size</span></code>
86 Bytes and stores a pointer to the stack and its actual size in <code class="computeroutput"><span class="identifier">sctx</span></code>. Depending on the architecture
87 (the stack grows downwards/upwards) the stored address is the highest/lowest
88 address of the stack.
89 </p></dd>
90</dl>
91</div>
92<h6>
93<a name="context.econtext.stack.segmented.h1"></a>
94 <span><a name="context.econtext.stack.segmented._code__phrase_role__keyword__void__phrase___phrase_role__identifier__deallocate__phrase__phrase_role__special_____phrase___phrase_role__identifier__stack_context__phrase___phrase_role__special___amp___phrase___phrase_role__identifier__sctx__phrase__phrase_role__special_____phrase___code_"></a></span><a class="link" href="segmented.html#context.econtext.stack.segmented._code__phrase_role__keyword__void__phrase___phrase_role__identifier__deallocate__phrase__phrase_role__special_____phrase___phrase_role__identifier__stack_context__phrase___phrase_role__special___amp___phrase___phrase_role__identifier__sctx__phrase__phrase_role__special_____phrase___code_"><code class="computeroutput"><span class="keyword">void</span> <span class="identifier">deallocate</span><span class="special">(</span> <span class="identifier">stack_context</span>
95 <span class="special">&amp;</span> <span class="identifier">sctx</span><span class="special">)</span></code></a>
96 </h6>
97<div class="variablelist">
98<p class="title"><b></b></p>
99<dl>
100<dt><span class="term">Preconditions:</span></dt>
101<dd><p>
102 <code class="computeroutput"><span class="identifier">sctx</span><span class="special">.</span><span class="identifier">sp</span></code> is valid, <code class="computeroutput"><span class="identifier">traits_type</span><span class="special">::</span><span class="identifier">minimum</span><span class="special">:</span><span class="identifier">size</span><span class="special">()</span> <span class="special">&lt;=</span>
103 <span class="identifier">sctx</span><span class="special">.</span><span class="identifier">size</span></code> and <code class="computeroutput"><span class="special">!</span>
104 <span class="identifier">traits_type</span><span class="special">::</span><span class="identifier">is_unbounded</span><span class="special">()</span>
105 <span class="special">&amp;&amp;</span> <span class="special">(</span>
106 <span class="identifier">traits_type</span><span class="special">::</span><span class="identifier">maximum</span><span class="special">:</span><span class="identifier">size</span><span class="special">()</span>
107 <span class="special">&gt;=</span> <span class="identifier">sctx</span><span class="special">.</span><span class="identifier">size</span><span class="special">)</span></code>.
108 </p></dd>
109<dt><span class="term">Effects:</span></dt>
110<dd><p>
111 Deallocates the stack space.
112 </p></dd>
113</dl>
114</div>
115</div>
116<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
117<td align="left"></td>
118<td align="right"><div class="copyright-footer">Copyright &#169; 2014 Oliver Kowalke<p>
119 Distributed under the Boost Software License, Version 1.0. (See accompanying
120 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
121 </p>
122</div></td>
123</tr></table>
124<hr>
125<div class="spirit-nav">
126<a accesskey="p" href="fixedsize.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../stack.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="stack_traits.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
127</div>
128</body>
129</html>