• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<html>
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5<title>Parallel - Fork-Join -- EXPERIMENTAL</title>
6<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
7<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
8<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
9<link rel="up" href="../thread.html" title="Chapter 39. Thread 4.8.0">
10<link rel="prev" href="sds.html" title="Synchronized Data Structures">
11<link rel="next" href="time.html" title="Time Requirements">
12</head>
13<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
14<table cellpadding="2" width="100%"><tr>
15<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
16<td align="center"><a href="../../../index.html">Home</a></td>
17<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
18<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
19<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
20<td align="center"><a href="../../../more/index.htm">More</a></td>
21</tr></table>
22<hr>
23<div class="spirit-nav">
24<a accesskey="p" href="sds.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../thread.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="time.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
25</div>
26<div class="section">
27<div class="titlepage"><div><div><h2 class="title" style="clear: both">
28<a name="thread.parallel"></a><a class="link" href="parallel.html" title="Parallel - Fork-Join -- EXPERIMENTAL">Parallel - Fork-Join -- EXPERIMENTAL</a>
29</h2></div></div></div>
30<div class="toc"><dl class="toc">
31<dt><span class="section"><a href="parallel.html#thread.parallel.fork_join">Fork-Join</a></span></dt>
32<dt><span class="section"><a href="parallel.html#thread.parallel.ref">Reference -- EXPERIMENTAL</a></span></dt>
33</dl></div>
34<div class="section">
35<div class="titlepage"><div><div><h3 class="title">
36<a name="thread.parallel.fork_join"></a><a class="link" href="parallel.html#thread.parallel.fork_join" title="Fork-Join">Fork-Join</a>
37</h3></div></div></div>
38<div class="toc"><dl class="toc">
39<dt><span class="section"><a href="parallel.html#thread.parallel.fork_join.introduction">Introduction</a></span></dt>
40<dt><span class="section"><a href="parallel.html#thread.parallel.fork_join.tutorial">Tutorial</a></span></dt>
41<dt><span class="section"><a href="parallel.html#thread.parallel.fork_join.examples">Examples</a></span></dt>
42<dt><span class="section"><a href="parallel.html#thread.parallel.fork_join.rationale">Design Rationale</a></span></dt>
43</dl></div>
44<div class="warning"><table border="0" summary="Warning">
45<tr>
46<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../doc/src/images/warning.png"></td>
47<th align="left">Warning</th>
48</tr>
49<tr><td align="left" valign="top"><p>
50          These features are experimental and subject to change in future versions.
51          There are not too much tests yet, so it is possible that you can find out
52          some trivial bugs :(
53        </p></td></tr>
54</table></div>
55<div class="note"><table border="0" summary="Note">
56<tr>
57<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../doc/src/images/note.png"></td>
58<th align="left">Note</th>
59</tr>
60<tr><td align="left" valign="top"><p>
61          These features are based on the <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4088.pdf" target="_top"><span class="bold"><strong>n4088 - Task Region R3</strong></span></a> C++1y proposal from
62          P. Halpern, A. Robison, A. Laksberg, H. Sutter, et al. The text that follows
63          has been adapted from this paper to show the differences.
64        </p></td></tr>
65</table></div>
66<p>
67        The major difference respect to the standard proposal is that we are able
68        to use a common executor for several task regions.
69      </p>
70<div class="note"><table border="0" summary="Note">
71<tr>
72<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../doc/src/images/note.png"></td>
73<th align="left">Note</th>
74</tr>
75<tr><td align="left" valign="top"><p>
76          Up to now, Boost.Thread doesn't implement the parallel algorithms as defined
77          in <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4105.pdf" target="_top"><span class="bold"><strong>n4105 - Information technology – Programming languages, their
78          environments and system software interfaces – Technical Specification
79          for C++ Extensions for Parallelism</strong></span></a>.
80        </p></td></tr>
81</table></div>
82<div class="section">
83<div class="titlepage"><div><div><h4 class="title">
84<a name="thread.parallel.fork_join.introduction"></a><a class="link" href="parallel.html#thread.parallel.fork_join.introduction" title="Introduction">Introduction</a>
85</h4></div></div></div>
86<p>
87          This module introduces a C++11/c++14 library function template <code class="computeroutput"><span class="identifier">task_region</span></code> and a library class <code class="computeroutput"><span class="identifier">task_region_handle</span></code> with member functions
88          <code class="computeroutput"><span class="identifier">run</span></code> and <code class="computeroutput"><span class="identifier">wait</span></code>
89          that together enable developers to write expressive and portable fork-join
90          parallel code.
91        </p>
92<p>
93          The working draft for the Parallelism TS <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4105.pdf" target="_top"><span class="bold"><strong>N4105</strong></span></a> augments the STL algorithms with the
94          inclusion of parallel execution policies. Programmers use these as a basis
95          to write additional high-level algorithms that can be implemented in terms
96          of the provided parallel algorithms. However, the scope of n4105 does not
97          include lower-level mechanisms to express arbitrary fork-join parallelism
98        </p>
99<p>
100          The <code class="computeroutput"><span class="identifier">task_region</span></code>, <code class="computeroutput"><span class="identifier">run</span></code> and the <code class="computeroutput"><span class="identifier">wait</span></code>
101          functions provided by this library are based on the <code class="computeroutput"><span class="identifier">task_group</span></code>
102          concept that is a part of the common subset of the PPL and the TBB libraries.
103        </p>
104</div>
105<div class="section">
106<div class="titlepage"><div><div><h4 class="title">
107<a name="thread.parallel.fork_join.tutorial"></a><a class="link" href="parallel.html#thread.parallel.fork_join.tutorial" title="Tutorial">Tutorial</a>
108</h4></div></div></div>
109<p>
110          Consider an example of a parallel traversal of a tree, where a user-provided
111          function compute is applied to each node of the tree, returning the sum
112          of the results:
113        </p>
114<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Func</span><span class="special">&gt;</span>
115<span class="keyword">int</span> <span class="identifier">traverse</span><span class="special">(</span><span class="identifier">node</span> <span class="special">*</span><span class="identifier">n</span><span class="special">,</span> <span class="identifier">Func</span><span class="special">&amp;&amp;</span> <span class="identifier">compute</span><span class="special">)</span>
116<span class="special">{</span>
117  <span class="keyword">int</span> <span class="identifier">left</span> <span class="special">=</span> <span class="number">0</span><span class="special">,</span> <span class="identifier">right</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
118  <span class="identifier">task_region</span><span class="special">([&amp;](</span><span class="identifier">task_region_handle</span><span class="special">&amp;</span> <span class="identifier">tr</span><span class="special">)</span> <span class="special">{</span>
119    <span class="keyword">if</span> <span class="special">(</span><span class="identifier">n</span><span class="special">-&gt;</span><span class="identifier">left</span><span class="special">)</span>
120      <span class="identifier">tr</span><span class="special">.</span><span class="identifier">run</span><span class="special">([&amp;]</span> <span class="special">{</span> <span class="identifier">left</span> <span class="special">=</span> <span class="identifier">traverse</span><span class="special">(</span><span class="identifier">n</span><span class="special">-&gt;</span><span class="identifier">left</span><span class="special">,</span> <span class="identifier">compute</span><span class="special">);</span> <span class="special">});</span>
121    <span class="keyword">if</span> <span class="special">(</span><span class="identifier">n</span><span class="special">-&gt;</span><span class="identifier">right</span><span class="special">)</span>
122      <span class="identifier">tr</span><span class="special">.</span><span class="identifier">run</span><span class="special">([&amp;]</span> <span class="special">{</span> <span class="identifier">right</span> <span class="special">=</span> <span class="identifier">traverse</span><span class="special">(</span><span class="identifier">n</span><span class="special">-&gt;</span><span class="identifier">right</span><span class="special">,</span> <span class="identifier">compute</span><span class="special">);</span> <span class="special">});</span>
123  <span class="special">});</span>
124  <span class="keyword">return</span> <span class="identifier">compute</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">left</span> <span class="special">+</span> <span class="identifier">right</span><span class="special">;</span>
125<span class="special">}</span>
126</pre>
127<p>
128          The example above demonstrates the use of two of the functions proposed
129          in this paper, <code class="computeroutput"><span class="identifier">task_region</span></code>
130          and <code class="computeroutput"><span class="identifier">task_region_handle</span><span class="special">::</span><span class="identifier">run</span></code>.
131          The <code class="computeroutput"><span class="identifier">task_region</span></code> function
132          delineates a region in a program code potentially containing invocations
133          of tasks spawned by the <code class="computeroutput"><span class="identifier">run</span></code>
134          member function of the <code class="computeroutput"><span class="identifier">task_region_handle</span></code>
135          class.
136        </p>
137<p>
138          The run function spawns a task, a unit of work that is allowed to execute
139          in parallel with respect to the caller. Any parallel tasks spawned by
140          <code class="computeroutput"><span class="identifier">run</span></code> within the <code class="computeroutput"><span class="identifier">task_region</span></code> are joined back to a single
141          thread of execution at the end of the <code class="computeroutput"><span class="identifier">task_region</span></code>.
142        </p>
143<p>
144          <code class="computeroutput"><span class="identifier">run</span></code> takes a user-provided
145          function object <code class="computeroutput"><span class="identifier">f</span></code> and starts
146          it asynchronously - i.e. it may return before the execution of <code class="computeroutput"><span class="identifier">f</span></code> completes. The implementation's scheduler
147          may choose to run <code class="computeroutput"><span class="identifier">f</span></code> immediately
148          or delay running <code class="computeroutput"><span class="identifier">f</span></code> until
149          compute resources become available.
150        </p>
151<p>
152          A <code class="computeroutput"><span class="identifier">task_region_handle</span></code> can
153          be constructed only by <code class="computeroutput"><span class="identifier">task_region</span></code>
154          because it has no public constructors. Thus, <code class="computeroutput"><span class="identifier">run</span></code>
155          can be invoked (directly or indirectly) only from a user-provided function
156          passed to <code class="computeroutput"><span class="identifier">task_region</span></code>:
157        </p>
158<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">g</span><span class="special">();</span>
159<span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">task_region_handle</span><span class="special">&amp;</span> <span class="identifier">tr</span><span class="special">)</span>
160<span class="special">{</span>
161  <span class="identifier">tr</span><span class="special">.</span><span class="identifier">run</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span> <span class="comment">// OK, invoked from within task_region in h</span>
162<span class="special">}</span>
163<span class="keyword">void</span> <span class="identifier">h</span><span class="special">()</span>
164<span class="special">{</span>
165  <span class="identifier">task_region</span><span class="special">(</span><span class="identifier">f</span><span class="special">);</span>
166<span class="special">}</span>
167
168<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
169<span class="special">{</span>
170  <span class="identifier">task_region_handle</span> <span class="identifier">tr</span><span class="special">;</span> <span class="comment">// Error: no public constructor</span>
171  <span class="identifier">tr</span><span class="special">.</span><span class="identifier">run</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span> <span class="comment">// No way to call run outside of a task_region</span>
172  <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
173<span class="special">}</span>
174</pre>
175</div>
176<div class="section">
177<div class="titlepage"><div><div><h4 class="title">
178<a name="thread.parallel.fork_join.examples"></a><a class="link" href="parallel.html#thread.parallel.fork_join.examples" title="Examples">Examples</a>
179</h4></div></div></div>
180<div class="toc"><dl class="toc">
181<dt><span class="section"><a href="parallel.html#thread.parallel.fork_join.examples.fib">Parallel
182          Fibonacci</a></span></dt>
183<dt><span class="section"><a href="parallel.html#thread.parallel.fork_join.examples.fibex">Parallel
184          Fibonacci - Specific executor</a></span></dt>
185<dt><span class="section"><a href="parallel.html#thread.parallel.fork_join.examples.quick_sort">Parallel
186          Accumulate</a></span></dt>
187<dt><span class="section"><a href="parallel.html#thread.parallel.fork_join.examples.quick_sort0">Parallel
188          Quick Sort</a></span></dt>
189</dl></div>
190<div class="section">
191<div class="titlepage"><div><div><h5 class="title">
192<a name="thread.parallel.fork_join.examples.fib"></a><a class="link" href="parallel.html#thread.parallel.fork_join.examples.fib" title="Parallel Fibonacci">Parallel
193          Fibonacci</a>
194</h5></div></div></div>
195<p>
196            This is surely the worst implementation of the Fibonacci function. Anyway,
197            here it is, as it is simple and shows the fork-join structure clearly.
198            <code class="computeroutput"><span class="identifier">Fibonacci</span><span class="special">(</span><span class="identifier">n</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">Fibonacci</span><span class="special">(</span><span class="identifier">n</span><span class="special">-</span><span class="number">1</span><span class="special">)</span>
199            <span class="special">+</span> <span class="identifier">Fibonacci</span><span class="special">(</span><span class="identifier">n</span><span class="special">-</span><span class="number">2</span><span class="special">)</span></code>,
200            so the task decomposition is trivial.
201          </p>
202<pre class="programlisting"><span class="keyword">int</span> <span class="identifier">fib_task_region</span><span class="special">(</span><span class="keyword">int</span> <span class="identifier">n</span><span class="special">)</span>
203<span class="special">{</span>
204  <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">parallel</span><span class="special">::</span><span class="identifier">task_region</span><span class="special">;</span>
205  <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">parallel</span><span class="special">::</span><span class="identifier">task_region_handle</span><span class="special">;</span>
206
207  <span class="keyword">if</span> <span class="special">(</span><span class="identifier">n</span> <span class="special">==</span> <span class="number">0</span><span class="special">)</span> <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
208  <span class="keyword">if</span> <span class="special">(</span><span class="identifier">n</span> <span class="special">==</span> <span class="number">1</span><span class="special">)</span> <span class="keyword">return</span> <span class="number">1</span><span class="special">;</span>
209
210  <span class="keyword">int</span> <span class="identifier">n1</span><span class="special">;</span>
211  <span class="keyword">int</span> <span class="identifier">n2</span><span class="special">;</span>
212
213  <span class="identifier">task_region</span><span class="special">([&amp;](</span><span class="identifier">task_region_handle</span><span class="special">&amp;</span> <span class="identifier">trh</span><span class="special">)</span>
214      <span class="special">{</span>
215        <span class="identifier">trh</span><span class="special">.</span><span class="identifier">run</span><span class="special">([&amp;]</span>
216            <span class="special">{</span>
217              <span class="identifier">n1</span> <span class="special">=</span> <span class="identifier">fib_task_region</span><span class="special">(</span><span class="identifier">n</span> <span class="special">-</span> <span class="number">1</span><span class="special">);</span>
218            <span class="special">});</span>
219
220        <span class="identifier">n2</span> <span class="special">=</span> <span class="identifier">fib_task_region</span><span class="special">(</span><span class="identifier">n</span> <span class="special">-</span> <span class="number">2</span><span class="special">);</span>
221      <span class="special">});</span>
222
223  <span class="keyword">return</span> <span class="identifier">n1</span> <span class="special">+</span> <span class="identifier">n2</span><span class="special">;</span>
224<span class="special">}</span>
225
226<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
227<span class="special">{</span>
228  <span class="keyword">for</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span><span class="special">&lt;</span><span class="number">10</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> <span class="special">{</span>
229    <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">fib_task_region</span><span class="special">(</span><span class="identifier">i</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="string">" "</span><span class="special">;</span>
230  <span class="special">}</span>
231  <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
232<span class="special">}</span>
233</pre>
234</div>
235<div class="section">
236<div class="titlepage"><div><div><h5 class="title">
237<a name="thread.parallel.fork_join.examples.fibex"></a><a class="link" href="parallel.html#thread.parallel.fork_join.examples.fibex" title="Parallel Fibonacci - Specific executor">Parallel
238          Fibonacci - Specific executor</a>
239</h5></div></div></div>
240<p>
241            The previous example make use of an implementation defined way to spawn
242            the tasks. Often the user wants to master how the task must be spawned.
243            There is an overload of <code class="computeroutput"><span class="identifier">task_region</span></code>
244            that accept an additional <code class="computeroutput"><span class="identifier">Executor</span></code>
245            parameter and a function that takes as parameter a <code class="computeroutput"><span class="identifier">task_region_handle_gen</span><span class="special">&lt;</span><span class="identifier">Executor</span><span class="special">&gt;</span></code>. <code class="computeroutput"><span class="identifier">task_region_handle_gen</span><span class="special">&lt;</span><span class="identifier">Executor</span><span class="special">&gt;</span></code> run uses this executor to spawn the
246            tasks.
247          </p>
248<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Ex</span><span class="special">&gt;</span>
249<span class="keyword">int</span> <span class="identifier">fib_task_region_gen</span><span class="special">(</span> <span class="identifier">Ex</span><span class="special">&amp;</span> <span class="identifier">ex</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">n</span><span class="special">)</span>
250<span class="special">{</span>
251  <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">parallel</span><span class="special">::</span><span class="identifier">task_region</span><span class="special">;</span>
252  <span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">experimental</span><span class="special">::</span><span class="identifier">parallel</span><span class="special">::</span><span class="identifier">task_region_handle_gen</span><span class="special">;</span>
253
254  <span class="keyword">if</span> <span class="special">(</span><span class="identifier">n</span> <span class="special">==</span> <span class="number">0</span><span class="special">)</span> <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
255  <span class="keyword">if</span> <span class="special">(</span><span class="identifier">n</span> <span class="special">==</span> <span class="number">1</span><span class="special">)</span> <span class="keyword">return</span> <span class="number">1</span><span class="special">;</span>
256
257  <span class="keyword">int</span> <span class="identifier">n1</span><span class="special">;</span>
258  <span class="keyword">int</span> <span class="identifier">n2</span><span class="special">;</span>
259
260  <span class="identifier">task_region</span><span class="special">(</span><span class="identifier">ex</span><span class="special">,</span> <span class="special">[&amp;](</span><span class="identifier">task_region_handle_gen</span><span class="special">&lt;</span><span class="identifier">Ex</span><span class="special">&gt;&amp;</span> <span class="identifier">trh</span><span class="special">)</span> <span class="comment">// (2)</span>
261      <span class="special">{</span>
262        <span class="identifier">trh</span><span class="special">.</span><span class="identifier">run</span><span class="special">([&amp;]</span>
263            <span class="special">{</span>
264              <span class="identifier">n1</span> <span class="special">=</span> <span class="identifier">fib_task_region</span><span class="special">(</span><span class="identifier">n</span> <span class="special">-</span> <span class="number">1</span><span class="special">);</span>
265            <span class="special">});</span>
266
267        <span class="identifier">n2</span> <span class="special">=</span> <span class="identifier">fib_task_region</span><span class="special">(</span><span class="identifier">n</span> <span class="special">-</span> <span class="number">2</span><span class="special">);</span>
268      <span class="special">});</span>
269
270  <span class="keyword">return</span> <span class="identifier">n1</span> <span class="special">+</span> <span class="identifier">n2</span><span class="special">;</span>
271<span class="special">}</span>
272
273<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
274<span class="special">{</span>
275  <span class="identifier">boost</span><span class="special">::</span><span class="identifier">basic_thread_pool</span> <span class="identifier">tp</span><span class="special">;</span> <span class="comment">// (1)</span>
276  <span class="keyword">for</span> <span class="special">(</span><span class="keyword">int</span> <span class="identifier">i</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span> <span class="identifier">i</span><span class="special">&lt;</span><span class="number">10</span><span class="special">;</span> <span class="special">++</span><span class="identifier">i</span><span class="special">)</span> <span class="special">{</span>
277    <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">fib_task_region_gen</span><span class="special">(</span><span class="identifier">tp</span><span class="special">,</span><span class="identifier">i</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="string">" "</span><span class="special">;</span>
278  <span class="special">}</span>
279  <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
280  <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
281<span class="special">}</span>
282</pre>
283<p>
284            The specific executor is declared in line (1) and it is used in line
285            (2).
286          </p>
287</div>
288<div class="section"><div class="titlepage"><div><div><h5 class="title">
289<a name="thread.parallel.fork_join.examples.quick_sort"></a><a class="link" href="parallel.html#thread.parallel.fork_join.examples.quick_sort" title="Parallel Accumulate">Parallel
290          Accumulate</a>
291</h5></div></div></div></div>
292<div class="section"><div class="titlepage"><div><div><h5 class="title">
293<a name="thread.parallel.fork_join.examples.quick_sort0"></a><a class="link" href="parallel.html#thread.parallel.fork_join.examples.quick_sort0" title="Parallel Quick Sort">Parallel
294          Quick Sort</a>
295</h5></div></div></div></div>
296</div>
297<div class="section"><div class="titlepage"><div><div><h4 class="title">
298<a name="thread.parallel.fork_join.rationale"></a><a class="link" href="parallel.html#thread.parallel.fork_join.rationale" title="Design Rationale">Design Rationale</a>
299</h4></div></div></div></div>
300</div>
301<div class="section">
302<div class="titlepage"><div><div><h3 class="title">
303<a name="thread.parallel.ref"></a><a class="link" href="parallel.html#thread.parallel.ref" title="Reference -- EXPERIMENTAL">Reference -- EXPERIMENTAL</a>
304</h3></div></div></div>
305<div class="toc"><dl class="toc">
306<dt><span class="section"><a href="parallel.html#thread.parallel.ref.v1">Parallel V1</a></span></dt>
307<dt><span class="section"><a href="parallel.html#thread.parallel.ref.v2">Parallel V2</a></span></dt>
308</dl></div>
309<div class="section">
310<div class="titlepage"><div><div><h4 class="title">
311<a name="thread.parallel.ref.v1"></a><a class="link" href="parallel.html#thread.parallel.ref.v1" title="Parallel V1">Parallel V1</a>
312</h4></div></div></div>
313<div class="toc"><dl class="toc"><dt><span class="section"><a href="parallel.html#thread.parallel.ref.v1.exception_list">Header <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">experimental</span><span class="special">/</span><span class="identifier">exception_list</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code></a></span></dt></dl></div>
314<div class="section">
315<div class="titlepage"><div><div><h5 class="title">
316<a name="thread.parallel.ref.v1.exception_list"></a><a class="link" href="parallel.html#thread.parallel.ref.v1.exception_list" title="Header &lt;experimental/exception_list.hpp&gt;">Header <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">experimental</span><span class="special">/</span><span class="identifier">exception_list</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code></a>
317</h5></div></div></div>
318<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
319<span class="special">{</span>
320<span class="keyword">namespace</span> <span class="identifier">experimental</span>
321<span class="special">{</span>
322<span class="keyword">namespace</span> <span class="identifier">parallel</span>
323<span class="special">{</span>
324<span class="keyword">inline</span> <span class="keyword">namespace</span> <span class="identifier">v1</span>
325<span class="special">{</span>
326
327  <span class="keyword">class</span> <span class="identifier">exception_list</span><span class="special">;</span>
328
329<span class="special">}</span> <span class="comment">// v1</span>
330<span class="special">}</span> <span class="comment">// parallel</span>
331<span class="special">}</span> <span class="comment">// experimental</span>
332<span class="special">}</span> <span class="comment">// boost</span>
333</pre>
334<div class="section">
335<div class="titlepage"><div><div><h6 class="title">
336<a name="thread.parallel.ref.v1.exception_list.exception_list"></a><a class="link" href="parallel.html#thread.parallel.ref.v1.exception_list.exception_list" title="Class exception_list">Class
337            <code class="computeroutput"><span class="identifier">exception_list</span></code></a>
338</h6></div></div></div>
339<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
340<span class="special">{</span>
341<span class="keyword">namespace</span> <span class="identifier">experimental</span>
342<span class="special">{</span>
343<span class="keyword">namespace</span> <span class="identifier">parallel</span>
344<span class="special">{</span>
345<span class="keyword">inline</span> <span class="keyword">namespace</span> <span class="identifier">v1</span>
346<span class="special">{</span>
347
348  <span class="keyword">class</span> <span class="identifier">exception_list</span><span class="special">:</span> <span class="keyword">public</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">exception</span>
349  <span class="special">{</span>
350  <span class="keyword">public</span><span class="special">:</span>
351    <span class="keyword">typedef</span> <span class="char">'implementation defined'</span> <span class="identifier">const_iterator</span><span class="special">;</span>
352
353    <span class="special">~</span><span class="identifier">exception_list</span><span class="special">()</span> <span class="keyword">noexcept</span> <span class="special">{}</span>
354
355    <span class="keyword">void</span> <span class="identifier">add</span><span class="special">(</span><span class="identifier">exception_ptr</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">e</span><span class="special">);</span>
356    <span class="identifier">size_t</span> <span class="identifier">size</span><span class="special">()</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
357    <span class="identifier">const_iterator</span> <span class="identifier">begin</span><span class="special">()</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
358    <span class="identifier">const_iterator</span> <span class="identifier">end</span><span class="special">()</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
359    <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">what</span><span class="special">()</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
360
361  <span class="special">};</span>
362
363<span class="special">}</span> <span class="comment">// v1</span>
364<span class="special">}</span> <span class="comment">// parallel</span>
365<span class="special">}</span> <span class="comment">// experimental</span>
366<span class="special">}</span> <span class="comment">// boost</span>
367</pre>
368</div>
369</div>
370</div>
371<div class="section">
372<div class="titlepage"><div><div><h4 class="title">
373<a name="thread.parallel.ref.v2"></a><a class="link" href="parallel.html#thread.parallel.ref.v2" title="Parallel V2">Parallel V2</a>
374</h4></div></div></div>
375<div class="toc"><dl class="toc">
376<dt><span class="section"><a href="parallel.html#thread.parallel.ref.v2.concepts">Concepts</a></span></dt>
377<dt><span class="section"><a href="parallel.html#thread.parallel.ref.v2.task_region">Header <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">experimental</span><span class="special">/</span><span class="identifier">task_region</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code></a></span></dt>
378</dl></div>
379<div class="section">
380<div class="titlepage"><div><div><h5 class="title">
381<a name="thread.parallel.ref.v2.concepts"></a><a class="link" href="parallel.html#thread.parallel.ref.v2.concepts" title="Concepts">Concepts</a>
382</h5></div></div></div>
383<div class="section"><div class="titlepage"><div><div><h6 class="title">
384<a name="thread.parallel.ref.v2.concepts.regionCallable"></a><a class="link" href="parallel.html#thread.parallel.ref.v2.concepts.regionCallable" title="Concept Region_Callable">Concept
385            <code class="computeroutput"><span class="identifier">Region_Callable</span></code></a>
386</h6></div></div></div></div>
387<div class="section"><div class="titlepage"><div><div><h6 class="title">
388<a name="thread.parallel.ref.v2.concepts.taskCallable"></a><a class="link" href="parallel.html#thread.parallel.ref.v2.concepts.taskCallable" title="Concept Task_Callable">Concept
389            <code class="computeroutput"><span class="identifier">Task_Callable</span></code></a>
390</h6></div></div></div></div>
391</div>
392<div class="section">
393<div class="titlepage"><div><div><h5 class="title">
394<a name="thread.parallel.ref.v2.task_region"></a><a class="link" href="parallel.html#thread.parallel.ref.v2.task_region" title="Header &lt;experimental/task_region.hpp&gt;">Header <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">experimental</span><span class="special">/</span><span class="identifier">task_region</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code></a>
395</h5></div></div></div>
396<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
397<span class="special">{</span>
398<span class="keyword">namespace</span> <span class="identifier">experimental</span>
399<span class="special">{</span>
400<span class="keyword">namespace</span> <span class="identifier">parallel</span>
401<span class="special">{</span>
402<span class="keyword">inline</span> <span class="keyword">namespace</span> <span class="identifier">v2</span>
403<span class="special">{</span>
404
405  <span class="keyword">class</span> <span class="identifier">task_canceled_exception</span><span class="special">;</span>
406
407  <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Executor</span><span class="special">&gt;</span>
408  <span class="keyword">class</span> <span class="identifier">task_region_handle_gen</span><span class="special">;</span>
409
410  <span class="keyword">using</span> <span class="identifier">default_executor</span> <span class="special">=</span> <span class="char">'implementation defined'</span><span class="special">;</span>
411
412  <span class="keyword">class</span> <span class="identifier">task_region_handle</span><span class="special">;</span>
413
414  <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Executor</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">F</span><span class="special">&gt;</span>
415    <span class="keyword">void</span> <span class="identifier">task_region_final</span><span class="special">(</span><span class="identifier">Executor</span><span class="special">&amp;</span> <span class="identifier">ex</span><span class="special">,</span> <span class="identifier">F</span><span class="special">&amp;&amp;</span> <span class="identifier">f</span><span class="special">);</span>
416  <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">F</span><span class="special">&gt;</span>
417    <span class="keyword">void</span> <span class="identifier">task_region_final</span><span class="special">(</span><span class="identifier">F</span><span class="special">&amp;&amp;</span> <span class="identifier">f</span><span class="special">);</span>
418
419  <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Executor</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">F</span><span class="special">&gt;</span>
420    <span class="keyword">void</span> <span class="identifier">task_region</span><span class="special">(</span><span class="identifier">Executor</span><span class="special">&amp;</span> <span class="identifier">ex</span><span class="special">,</span> <span class="identifier">F</span><span class="special">&amp;&amp;</span> <span class="identifier">f</span><span class="special">);</span>
421  <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">F</span><span class="special">&gt;</span>
422    <span class="keyword">void</span> <span class="identifier">task_region</span><span class="special">(</span><span class="identifier">F</span><span class="special">&amp;&amp;</span> <span class="identifier">f</span><span class="special">);</span>
423
424<span class="special">}</span> <span class="comment">// v2</span>
425<span class="special">}</span> <span class="comment">// parallel</span>
426<span class="special">}</span> <span class="comment">// experimental</span>
427<span class="special">}</span> <span class="comment">// boost</span>
428</pre>
429<div class="section">
430<div class="titlepage"><div><div><h6 class="title">
431<a name="thread.parallel.ref.v2.task_region.task_canceled_exception"></a><a class="link" href="parallel.html#thread.parallel.ref.v2.task_region.task_canceled_exception" title="Class task_canceled_exception">Class
432            <code class="computeroutput"><span class="identifier">task_canceled_exception</span> </code></a>
433</h6></div></div></div>
434<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
435<span class="special">{</span>
436<span class="keyword">namespace</span> <span class="identifier">experimental</span>
437<span class="special">{</span>
438<span class="keyword">namespace</span> <span class="identifier">parallel</span>
439<span class="special">{</span>
440<span class="keyword">inline</span> <span class="keyword">namespace</span> <span class="identifier">v2</span>
441<span class="special">{</span>
442
443  <span class="keyword">class</span> <span class="identifier">task_canceled_exception</span><span class="special">:</span> <span class="keyword">public</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">exception</span>
444  <span class="special">{</span>
445  <span class="keyword">public</span><span class="special">:</span>
446    <span class="identifier">task_canceled_exception</span><span class="special">()</span> <span class="keyword">noexcept</span><span class="special">;</span>
447    <span class="identifier">task_canceled_exception</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">task_canceled_exception</span><span class="special">&amp;)</span> <span class="keyword">noexcept</span><span class="special">;</span>
448    <span class="identifier">task_canceled_exception</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="identifier">task_canceled_exception</span><span class="special">&amp;)</span> <span class="keyword">noexcept</span><span class="special">;</span>
449    <span class="keyword">virtual</span> <span class="keyword">const</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">what</span><span class="special">()</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
450  <span class="special">};</span>
451
452<span class="special">}</span> <span class="comment">// v2</span>
453<span class="special">}</span> <span class="comment">// parallel</span>
454<span class="special">}</span> <span class="comment">// experimental</span>
455<span class="special">}</span> <span class="comment">// boost</span>
456</pre>
457</div>
458<div class="section">
459<div class="titlepage"><div><div><h6 class="title">
460<a name="thread.parallel.ref.v2.task_region.task_region_handle_gen"></a><a class="link" href="parallel.html#thread.parallel.ref.v2.task_region.task_region_handle_gen" title="Template Class task_region_handle_gen&lt;&gt;">Template
461            Class <code class="computeroutput"><span class="identifier">task_region_handle_gen</span><span class="special">&lt;&gt;</span></code></a>
462</h6></div></div></div>
463<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
464<span class="special">{</span>
465<span class="keyword">namespace</span> <span class="identifier">experimental</span>
466<span class="special">{</span>
467<span class="keyword">namespace</span> <span class="identifier">parallel</span>
468<span class="special">{</span>
469<span class="keyword">inline</span> <span class="keyword">namespace</span> <span class="identifier">v2</span>
470<span class="special">{</span>
471
472  <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Executor</span><span class="special">&gt;</span>
473  <span class="keyword">class</span> <span class="identifier">task_region_handle_gen</span>
474  <span class="special">{</span>
475  <span class="keyword">protected</span><span class="special">:</span>
476    <span class="identifier">task_region_handle_gen</span><span class="special">(</span><span class="identifier">Executor</span><span class="special">&amp;</span> <span class="identifier">ex</span><span class="special">);</span>
477
478    <span class="special">~</span><span class="identifier">task_region_handle_gen</span><span class="special">();</span>
479
480  <span class="keyword">public</span><span class="special">:</span>
481    <span class="identifier">task_region_handle_gen</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">task_region_handle_gen</span><span class="special">&amp;)</span> <span class="special">=</span> <span class="keyword">delete</span><span class="special">;</span>
482    <span class="identifier">task_region_handle_gen</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="identifier">task_region_handle_gen</span><span class="special">&amp;)</span> <span class="special">=</span> <span class="keyword">delete</span><span class="special">;</span>
483    <span class="identifier">task_region_handle_gen</span><span class="special">*</span> <span class="keyword">operator</span><span class="special">&amp;()</span> <span class="keyword">const</span> <span class="special">=</span> <span class="keyword">delete</span><span class="special">;</span>
484
485    <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">F</span><span class="special">&gt;</span>
486    <span class="keyword">void</span> <span class="identifier">run</span><span class="special">(</span><span class="identifier">F</span><span class="special">&amp;&amp;</span> <span class="identifier">f</span><span class="special">);</span>
487
488    <span class="keyword">void</span> <span class="identifier">wait</span><span class="special">();</span>
489  <span class="special">};</span>
490
491<span class="special">}</span> <span class="comment">// v2</span>
492<span class="special">}</span> <span class="comment">// parallel</span>
493<span class="special">}</span> <span class="comment">// experimental</span>
494<span class="special">}</span> <span class="comment">// boost</span>
495</pre>
496</div>
497<div class="section">
498<div class="titlepage"><div><div><h6 class="title">
499<a name="thread.parallel.ref.v2.task_region.default_executor"></a><a class="link" href="parallel.html#thread.parallel.ref.v2.task_region.default_executor" title="Class default_executor">Class
500            <code class="computeroutput"><span class="identifier">default_executor</span> </code></a>
501</h6></div></div></div>
502<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
503<span class="special">{</span>
504<span class="keyword">namespace</span> <span class="identifier">experimental</span>
505<span class="special">{</span>
506<span class="keyword">namespace</span> <span class="identifier">parallel</span>
507<span class="special">{</span>
508<span class="keyword">inline</span> <span class="keyword">namespace</span> <span class="identifier">v2</span>
509<span class="special">{</span>
510
511  <span class="keyword">using</span> <span class="identifier">default_executor</span> <span class="special">=</span> <span class="char">'implementation defined'</span><span class="special">;</span>
512
513<span class="special">}</span> <span class="comment">// v2</span>
514<span class="special">}</span> <span class="comment">// parallel</span>
515<span class="special">}</span> <span class="comment">// experimental</span>
516<span class="special">}</span> <span class="comment">// boost</span>
517</pre>
518</div>
519<div class="section">
520<div class="titlepage"><div><div><h6 class="title">
521<a name="thread.parallel.ref.v2.task_region.task_region_handle"></a><a class="link" href="parallel.html#thread.parallel.ref.v2.task_region.task_region_handle" title="Class task_region_handle">Class
522            <code class="computeroutput"><span class="identifier">task_region_handle</span> </code></a>
523</h6></div></div></div>
524<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
525<span class="special">{</span>
526<span class="keyword">namespace</span> <span class="identifier">experimental</span>
527<span class="special">{</span>
528<span class="keyword">namespace</span> <span class="identifier">parallel</span>
529<span class="special">{</span>
530<span class="keyword">inline</span> <span class="keyword">namespace</span> <span class="identifier">v2</span>
531<span class="special">{</span>
532
533  <span class="keyword">class</span> <span class="identifier">task_region_handle</span> <span class="special">:</span>
534    <span class="keyword">public</span> <span class="identifier">task_region_handle_gen</span><span class="special">&lt;</span><span class="identifier">default_executor</span><span class="special">&gt;</span>
535  <span class="special">{</span>
536  <span class="keyword">protected</span><span class="special">:</span>
537    <span class="identifier">task_region_handle</span><span class="special">();</span>
538    <span class="identifier">task_region_handle</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">task_region_handle</span><span class="special">&amp;)</span> <span class="special">=</span> <span class="keyword">delete</span><span class="special">;</span>
539    <span class="identifier">task_region_handle</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">=(</span><span class="keyword">const</span> <span class="identifier">task_region_handle</span><span class="special">&amp;)</span> <span class="special">=</span> <span class="keyword">delete</span><span class="special">;</span>
540    <span class="identifier">task_region_handle</span><span class="special">*</span> <span class="keyword">operator</span><span class="special">&amp;()</span> <span class="keyword">const</span> <span class="special">=</span> <span class="keyword">delete</span><span class="special">;</span>
541
542  <span class="special">};</span>
543
544<span class="special">}</span> <span class="comment">// v2</span>
545<span class="special">}</span> <span class="comment">// parallel</span>
546<span class="special">}</span> <span class="comment">// experimental</span>
547<span class="special">}</span> <span class="comment">// boost</span>
548</pre>
549</div>
550<div class="section">
551<div class="titlepage"><div><div><h6 class="title">
552<a name="thread.parallel.ref.v2.task_region.task_region_final"></a><a class="link" href="parallel.html#thread.parallel.ref.v2.task_region.task_region_final" title="Template Function task_region_final">Template
553            Function <code class="computeroutput"><span class="identifier">task_region_final</span>
554            </code></a>
555</h6></div></div></div>
556<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
557<span class="special">{</span>
558<span class="keyword">namespace</span> <span class="identifier">experimental</span>
559<span class="special">{</span>
560<span class="keyword">namespace</span> <span class="identifier">parallel</span>
561<span class="special">{</span>
562<span class="keyword">inline</span> <span class="keyword">namespace</span> <span class="identifier">v2</span>
563<span class="special">{</span>
564
565  <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Executor</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">F</span><span class="special">&gt;</span>
566    <span class="keyword">void</span> <span class="identifier">task_region_final</span><span class="special">(</span><span class="identifier">Executor</span><span class="special">&amp;</span> <span class="identifier">ex</span><span class="special">,</span> <span class="identifier">F</span><span class="special">&amp;&amp;</span> <span class="identifier">f</span><span class="special">);</span>
567  <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">F</span><span class="special">&gt;</span>
568    <span class="keyword">void</span> <span class="identifier">task_region_final</span><span class="special">(</span><span class="identifier">F</span><span class="special">&amp;&amp;</span> <span class="identifier">f</span><span class="special">);</span>
569
570<span class="special">}</span> <span class="comment">// v2</span>
571<span class="special">}</span> <span class="comment">// parallel</span>
572<span class="special">}</span> <span class="comment">// experimental</span>
573<span class="special">}</span> <span class="comment">// boost</span>
574</pre>
575</div>
576<div class="section">
577<div class="titlepage"><div><div><h6 class="title">
578<a name="thread.parallel.ref.v2.task_region.task_region"></a><a class="link" href="parallel.html#thread.parallel.ref.v2.task_region.task_region" title="Template Function task_region">Template
579            Function <code class="computeroutput"><span class="identifier">task_region</span> </code></a>
580</h6></div></div></div>
581<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
582<span class="special">{</span>
583<span class="keyword">namespace</span> <span class="identifier">experimental</span>
584<span class="special">{</span>
585<span class="keyword">namespace</span> <span class="identifier">parallel</span>
586<span class="special">{</span>
587<span class="keyword">inline</span> <span class="keyword">namespace</span> <span class="identifier">v2</span>
588<span class="special">{</span>
589
590  <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Executor</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">F</span><span class="special">&gt;</span>
591    <span class="keyword">void</span> <span class="identifier">task_region</span><span class="special">(</span><span class="identifier">Executor</span><span class="special">&amp;</span> <span class="identifier">ex</span><span class="special">,</span> <span class="identifier">F</span><span class="special">&amp;&amp;</span> <span class="identifier">f</span><span class="special">);</span>
592  <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">F</span><span class="special">&gt;</span>
593    <span class="keyword">void</span> <span class="identifier">task_region</span><span class="special">(</span><span class="identifier">F</span><span class="special">&amp;&amp;</span> <span class="identifier">f</span><span class="special">);</span>
594
595<span class="special">}</span> <span class="comment">// v2</span>
596<span class="special">}</span> <span class="comment">// parallel</span>
597<span class="special">}</span> <span class="comment">// experimental</span>
598<span class="special">}</span> <span class="comment">// boost</span>
599</pre>
600</div>
601</div>
602</div>
603</div>
604</div>
605<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
606<td align="left"></td>
607<td align="right"><div class="copyright-footer">Copyright © 2007 -11 Anthony Williams<br>Copyright © 2011 -17 Vicente J. Botet Escriba<p>
608        Distributed under the Boost Software License, Version 1.0. (See accompanying
609        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>)
610      </p>
611</div></td>
612</tr></table>
613<hr>
614<div class="spirit-nav">
615<a accesskey="p" href="sds.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../thread.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="time.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
616</div>
617</body>
618</html>
619