619 lines
55 KiB
HTML
619 lines
55 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||
<html>
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||
<title>Parallel - Fork-Join -- EXPERIMENTAL</title>
|
||
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
|
||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
|
||
<link rel="up" href="../thread.html" title="Chapter 40. Thread 4.8.0">
|
||
<link rel="prev" href="sds.html" title="Synchronized Data Structures">
|
||
<link rel="next" href="time.html" title="Time Requirements">
|
||
</head>
|
||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||
<table cellpadding="2" width="100%"><tr>
|
||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
|
||
<td align="center"><a href="../../../index.html">Home</a></td>
|
||
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
|
||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||
<td align="center"><a href="../../../more/index.htm">More</a></td>
|
||
</tr></table>
|
||
<hr>
|
||
<div class="spirit-nav">
|
||
<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>
|
||
</div>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||
<a name="thread.parallel"></a><a class="link" href="parallel.html" title="Parallel - Fork-Join -- EXPERIMENTAL">Parallel - Fork-Join -- EXPERIMENTAL</a>
|
||
</h2></div></div></div>
|
||
<div class="toc"><dl class="toc">
|
||
<dt><span class="section"><a href="parallel.html#thread.parallel.fork_join">Fork-Join</a></span></dt>
|
||
<dt><span class="section"><a href="parallel.html#thread.parallel.ref">Reference -- EXPERIMENTAL</a></span></dt>
|
||
</dl></div>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h3 class="title">
|
||
<a name="thread.parallel.fork_join"></a><a class="link" href="parallel.html#thread.parallel.fork_join" title="Fork-Join">Fork-Join</a>
|
||
</h3></div></div></div>
|
||
<div class="toc"><dl class="toc">
|
||
<dt><span class="section"><a href="parallel.html#thread.parallel.fork_join.introduction">Introduction</a></span></dt>
|
||
<dt><span class="section"><a href="parallel.html#thread.parallel.fork_join.tutorial">Tutorial</a></span></dt>
|
||
<dt><span class="section"><a href="parallel.html#thread.parallel.fork_join.examples">Examples</a></span></dt>
|
||
<dt><span class="section"><a href="parallel.html#thread.parallel.fork_join.rationale">Design Rationale</a></span></dt>
|
||
</dl></div>
|
||
<div class="warning"><table border="0" summary="Warning">
|
||
<tr>
|
||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../doc/src/images/warning.png"></td>
|
||
<th align="left">Warning</th>
|
||
</tr>
|
||
<tr><td align="left" valign="top"><p>
|
||
These features are experimental and subject to change in future versions.
|
||
There are not too much tests yet, so it is possible that you can find out
|
||
some trivial bugs :(
|
||
</p></td></tr>
|
||
</table></div>
|
||
<div class="note"><table border="0" summary="Note">
|
||
<tr>
|
||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../doc/src/images/note.png"></td>
|
||
<th align="left">Note</th>
|
||
</tr>
|
||
<tr><td align="left" valign="top"><p>
|
||
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
|
||
P. Halpern, A. Robison, A. Laksberg, H. Sutter, et al. The text that follows
|
||
has been adapted from this paper to show the differences.
|
||
</p></td></tr>
|
||
</table></div>
|
||
<p>
|
||
The major difference respect to the standard proposal is that we are able
|
||
to use a common executor for several task regions.
|
||
</p>
|
||
<div class="note"><table border="0" summary="Note">
|
||
<tr>
|
||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../doc/src/images/note.png"></td>
|
||
<th align="left">Note</th>
|
||
</tr>
|
||
<tr><td align="left" valign="top"><p>
|
||
Up to now, Boost.Thread doesn't implement the parallel algorithms as defined
|
||
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
|
||
environments and system software interfaces – Technical Specification
|
||
for C++ Extensions for Parallelism</strong></span></a>.
|
||
</p></td></tr>
|
||
</table></div>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h4 class="title">
|
||
<a name="thread.parallel.fork_join.introduction"></a><a class="link" href="parallel.html#thread.parallel.fork_join.introduction" title="Introduction">Introduction</a>
|
||
</h4></div></div></div>
|
||
<p>
|
||
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
|
||
<code class="computeroutput"><span class="identifier">run</span></code> and <code class="computeroutput"><span class="identifier">wait</span></code>
|
||
that together enable developers to write expressive and portable fork-join
|
||
parallel code.
|
||
</p>
|
||
<p>
|
||
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
|
||
inclusion of parallel execution policies. Programmers use these as a basis
|
||
to write additional high-level algorithms that can be implemented in terms
|
||
of the provided parallel algorithms. However, the scope of n4105 does not
|
||
include lower-level mechanisms to express arbitrary fork-join parallelism
|
||
</p>
|
||
<p>
|
||
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>
|
||
functions provided by this library are based on the <code class="computeroutput"><span class="identifier">task_group</span></code>
|
||
concept that is a part of the common subset of the PPL and the TBB libraries.
|
||
</p>
|
||
</div>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h4 class="title">
|
||
<a name="thread.parallel.fork_join.tutorial"></a><a class="link" href="parallel.html#thread.parallel.fork_join.tutorial" title="Tutorial">Tutorial</a>
|
||
</h4></div></div></div>
|
||
<p>
|
||
Consider an example of a parallel traversal of a tree, where a user-provided
|
||
function compute is applied to each node of the tree, returning the sum
|
||
of the results:
|
||
</p>
|
||
<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Func</span><span class="special">></span>
|
||
<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">&&</span> <span class="identifier">compute</span><span class="special">)</span>
|
||
<span class="special">{</span>
|
||
<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>
|
||
<span class="identifier">task_region</span><span class="special">([&](</span><span class="identifier">task_region_handle</span><span class="special">&</span> <span class="identifier">tr</span><span class="special">)</span> <span class="special">{</span>
|
||
<span class="keyword">if</span> <span class="special">(</span><span class="identifier">n</span><span class="special">-></span><span class="identifier">left</span><span class="special">)</span>
|
||
<span class="identifier">tr</span><span class="special">.</span><span class="identifier">run</span><span class="special">([&]</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">-></span><span class="identifier">left</span><span class="special">,</span> <span class="identifier">compute</span><span class="special">);</span> <span class="special">});</span>
|
||
<span class="keyword">if</span> <span class="special">(</span><span class="identifier">n</span><span class="special">-></span><span class="identifier">right</span><span class="special">)</span>
|
||
<span class="identifier">tr</span><span class="special">.</span><span class="identifier">run</span><span class="special">([&]</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">-></span><span class="identifier">right</span><span class="special">,</span> <span class="identifier">compute</span><span class="special">);</span> <span class="special">});</span>
|
||
<span class="special">});</span>
|
||
<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>
|
||
<span class="special">}</span>
|
||
</pre>
|
||
<p>
|
||
The example above demonstrates the use of two of the functions proposed
|
||
in this paper, <code class="computeroutput"><span class="identifier">task_region</span></code>
|
||
and <code class="computeroutput"><span class="identifier">task_region_handle</span><span class="special">::</span><span class="identifier">run</span></code>.
|
||
The <code class="computeroutput"><span class="identifier">task_region</span></code> function
|
||
delineates a region in a program code potentially containing invocations
|
||
of tasks spawned by the <code class="computeroutput"><span class="identifier">run</span></code>
|
||
member function of the <code class="computeroutput"><span class="identifier">task_region_handle</span></code>
|
||
class.
|
||
</p>
|
||
<p>
|
||
The run function spawns a task, a unit of work that is allowed to execute
|
||
in parallel with respect to the caller. Any parallel tasks spawned by
|
||
<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
|
||
thread of execution at the end of the <code class="computeroutput"><span class="identifier">task_region</span></code>.
|
||
</p>
|
||
<p>
|
||
<code class="computeroutput"><span class="identifier">run</span></code> takes a user-provided
|
||
function object <code class="computeroutput"><span class="identifier">f</span></code> and starts
|
||
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
|
||
may choose to run <code class="computeroutput"><span class="identifier">f</span></code> immediately
|
||
or delay running <code class="computeroutput"><span class="identifier">f</span></code> until
|
||
compute resources become available.
|
||
</p>
|
||
<p>
|
||
A <code class="computeroutput"><span class="identifier">task_region_handle</span></code> can
|
||
be constructed only by <code class="computeroutput"><span class="identifier">task_region</span></code>
|
||
because it has no public constructors. Thus, <code class="computeroutput"><span class="identifier">run</span></code>
|
||
can be invoked (directly or indirectly) only from a user-provided function
|
||
passed to <code class="computeroutput"><span class="identifier">task_region</span></code>:
|
||
</p>
|
||
<pre class="programlisting"><span class="keyword">void</span> <span class="identifier">g</span><span class="special">();</span>
|
||
<span class="keyword">void</span> <span class="identifier">f</span><span class="special">(</span><span class="identifier">task_region_handle</span><span class="special">&</span> <span class="identifier">tr</span><span class="special">)</span>
|
||
<span class="special">{</span>
|
||
<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>
|
||
<span class="special">}</span>
|
||
<span class="keyword">void</span> <span class="identifier">h</span><span class="special">()</span>
|
||
<span class="special">{</span>
|
||
<span class="identifier">task_region</span><span class="special">(</span><span class="identifier">f</span><span class="special">);</span>
|
||
<span class="special">}</span>
|
||
|
||
<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
|
||
<span class="special">{</span>
|
||
<span class="identifier">task_region_handle</span> <span class="identifier">tr</span><span class="special">;</span> <span class="comment">// Error: no public constructor</span>
|
||
<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>
|
||
<span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
|
||
<span class="special">}</span>
|
||
</pre>
|
||
</div>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h4 class="title">
|
||
<a name="thread.parallel.fork_join.examples"></a><a class="link" href="parallel.html#thread.parallel.fork_join.examples" title="Examples">Examples</a>
|
||
</h4></div></div></div>
|
||
<div class="toc"><dl class="toc">
|
||
<dt><span class="section"><a href="parallel.html#thread.parallel.fork_join.examples.fib">Parallel
|
||
Fibonacci</a></span></dt>
|
||
<dt><span class="section"><a href="parallel.html#thread.parallel.fork_join.examples.fibex">Parallel
|
||
Fibonacci - Specific executor</a></span></dt>
|
||
<dt><span class="section"><a href="parallel.html#thread.parallel.fork_join.examples.quick_sort">Parallel
|
||
Accumulate</a></span></dt>
|
||
<dt><span class="section"><a href="parallel.html#thread.parallel.fork_join.examples.quick_sort0">Parallel
|
||
Quick Sort</a></span></dt>
|
||
</dl></div>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h5 class="title">
|
||
<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
|
||
Fibonacci</a>
|
||
</h5></div></div></div>
|
||
<p>
|
||
This is surely the worst implementation of the Fibonacci function. Anyway,
|
||
here it is, as it is simple and shows the fork-join structure clearly.
|
||
<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>
|
||
<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>,
|
||
so the task decomposition is trivial.
|
||
</p>
|
||
<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>
|
||
<span class="special">{</span>
|
||
<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>
|
||
<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>
|
||
|
||
<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>
|
||
<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>
|
||
|
||
<span class="keyword">int</span> <span class="identifier">n1</span><span class="special">;</span>
|
||
<span class="keyword">int</span> <span class="identifier">n2</span><span class="special">;</span>
|
||
|
||
<span class="identifier">task_region</span><span class="special">([&](</span><span class="identifier">task_region_handle</span><span class="special">&</span> <span class="identifier">trh</span><span class="special">)</span>
|
||
<span class="special">{</span>
|
||
<span class="identifier">trh</span><span class="special">.</span><span class="identifier">run</span><span class="special">([&]</span>
|
||
<span class="special">{</span>
|
||
<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>
|
||
<span class="special">});</span>
|
||
|
||
<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>
|
||
<span class="special">});</span>
|
||
|
||
<span class="keyword">return</span> <span class="identifier">n1</span> <span class="special">+</span> <span class="identifier">n2</span><span class="special">;</span>
|
||
<span class="special">}</span>
|
||
|
||
<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
|
||
<span class="special">{</span>
|
||
<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"><</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>
|
||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">fib_task_region</span><span class="special">(</span><span class="identifier">i</span><span class="special">)</span> <span class="special"><<</span> <span class="string">" "</span><span class="special">;</span>
|
||
<span class="special">}</span>
|
||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||
<span class="special">}</span>
|
||
</pre>
|
||
</div>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h5 class="title">
|
||
<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
|
||
Fibonacci - Specific executor</a>
|
||
</h5></div></div></div>
|
||
<p>
|
||
The previous example make use of an implementation defined way to spawn
|
||
the tasks. Often the user wants to master how the task must be spawned.
|
||
There is an overload of <code class="computeroutput"><span class="identifier">task_region</span></code>
|
||
that accept an additional <code class="computeroutput"><span class="identifier">Executor</span></code>
|
||
parameter and a function that takes as parameter a <code class="computeroutput"><span class="identifier">task_region_handle_gen</span><span class="special"><</span><span class="identifier">Executor</span><span class="special">></span></code>. <code class="computeroutput"><span class="identifier">task_region_handle_gen</span><span class="special"><</span><span class="identifier">Executor</span><span class="special">></span></code> run uses this executor to spawn the
|
||
tasks.
|
||
</p>
|
||
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Ex</span><span class="special">></span>
|
||
<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">&</span> <span class="identifier">ex</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">n</span><span class="special">)</span>
|
||
<span class="special">{</span>
|
||
<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>
|
||
<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>
|
||
|
||
<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>
|
||
<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>
|
||
|
||
<span class="keyword">int</span> <span class="identifier">n1</span><span class="special">;</span>
|
||
<span class="keyword">int</span> <span class="identifier">n2</span><span class="special">;</span>
|
||
|
||
<span class="identifier">task_region</span><span class="special">(</span><span class="identifier">ex</span><span class="special">,</span> <span class="special">[&](</span><span class="identifier">task_region_handle_gen</span><span class="special"><</span><span class="identifier">Ex</span><span class="special">>&</span> <span class="identifier">trh</span><span class="special">)</span> <span class="comment">// (2)</span>
|
||
<span class="special">{</span>
|
||
<span class="identifier">trh</span><span class="special">.</span><span class="identifier">run</span><span class="special">([&]</span>
|
||
<span class="special">{</span>
|
||
<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>
|
||
<span class="special">});</span>
|
||
|
||
<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>
|
||
<span class="special">});</span>
|
||
|
||
<span class="keyword">return</span> <span class="identifier">n1</span> <span class="special">+</span> <span class="identifier">n2</span><span class="special">;</span>
|
||
<span class="special">}</span>
|
||
|
||
<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
|
||
<span class="special">{</span>
|
||
<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>
|
||
<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"><</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>
|
||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</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"><<</span> <span class="string">" "</span><span class="special">;</span>
|
||
<span class="special">}</span>
|
||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||
<span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
|
||
<span class="special">}</span>
|
||
</pre>
|
||
<p>
|
||
The specific executor is declared in line (1) and it is used in line
|
||
(2).
|
||
</p>
|
||
</div>
|
||
<div class="section"><div class="titlepage"><div><div><h5 class="title">
|
||
<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
|
||
Accumulate</a>
|
||
</h5></div></div></div></div>
|
||
<div class="section"><div class="titlepage"><div><div><h5 class="title">
|
||
<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
|
||
Quick Sort</a>
|
||
</h5></div></div></div></div>
|
||
</div>
|
||
<div class="section"><div class="titlepage"><div><div><h4 class="title">
|
||
<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>
|
||
</h4></div></div></div></div>
|
||
</div>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h3 class="title">
|
||
<a name="thread.parallel.ref"></a><a class="link" href="parallel.html#thread.parallel.ref" title="Reference -- EXPERIMENTAL">Reference -- EXPERIMENTAL</a>
|
||
</h3></div></div></div>
|
||
<div class="toc"><dl class="toc">
|
||
<dt><span class="section"><a href="parallel.html#thread.parallel.ref.v1">Parallel V1</a></span></dt>
|
||
<dt><span class="section"><a href="parallel.html#thread.parallel.ref.v2">Parallel V2</a></span></dt>
|
||
</dl></div>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h4 class="title">
|
||
<a name="thread.parallel.ref.v1"></a><a class="link" href="parallel.html#thread.parallel.ref.v1" title="Parallel V1">Parallel V1</a>
|
||
</h4></div></div></div>
|
||
<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"><</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">></span></code></a></span></dt></dl></div>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h5 class="title">
|
||
<a name="thread.parallel.ref.v1.exception_list"></a><a class="link" href="parallel.html#thread.parallel.ref.v1.exception_list" title="Header <experimental/exception_list.hpp>">Header <code class="computeroutput"><span class="special"><</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">></span></code></a>
|
||
</h5></div></div></div>
|
||
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">namespace</span> <span class="identifier">experimental</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">namespace</span> <span class="identifier">parallel</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">inline</span> <span class="keyword">namespace</span> <span class="identifier">v1</span>
|
||
<span class="special">{</span>
|
||
|
||
<span class="keyword">class</span> <span class="identifier">exception_list</span><span class="special">;</span>
|
||
|
||
<span class="special">}</span> <span class="comment">// v1</span>
|
||
<span class="special">}</span> <span class="comment">// parallel</span>
|
||
<span class="special">}</span> <span class="comment">// experimental</span>
|
||
<span class="special">}</span> <span class="comment">// boost</span>
|
||
</pre>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h6 class="title">
|
||
<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
|
||
<code class="computeroutput"><span class="identifier">exception_list</span></code></a>
|
||
</h6></div></div></div>
|
||
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">namespace</span> <span class="identifier">experimental</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">namespace</span> <span class="identifier">parallel</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">inline</span> <span class="keyword">namespace</span> <span class="identifier">v1</span>
|
||
<span class="special">{</span>
|
||
|
||
<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>
|
||
<span class="special">{</span>
|
||
<span class="keyword">public</span><span class="special">:</span>
|
||
<span class="keyword">typedef</span> <span class="char">'implementation defined'</span> <span class="identifier">const_iterator</span><span class="special">;</span>
|
||
|
||
<span class="special">~</span><span class="identifier">exception_list</span><span class="special">()</span> <span class="keyword">noexcept</span> <span class="special">{}</span>
|
||
|
||
<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">&</span> <span class="identifier">e</span><span class="special">);</span>
|
||
<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>
|
||
<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>
|
||
<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>
|
||
<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>
|
||
|
||
<span class="special">};</span>
|
||
|
||
<span class="special">}</span> <span class="comment">// v1</span>
|
||
<span class="special">}</span> <span class="comment">// parallel</span>
|
||
<span class="special">}</span> <span class="comment">// experimental</span>
|
||
<span class="special">}</span> <span class="comment">// boost</span>
|
||
</pre>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h4 class="title">
|
||
<a name="thread.parallel.ref.v2"></a><a class="link" href="parallel.html#thread.parallel.ref.v2" title="Parallel V2">Parallel V2</a>
|
||
</h4></div></div></div>
|
||
<div class="toc"><dl class="toc">
|
||
<dt><span class="section"><a href="parallel.html#thread.parallel.ref.v2.concepts">Concepts</a></span></dt>
|
||
<dt><span class="section"><a href="parallel.html#thread.parallel.ref.v2.task_region">Header <code class="computeroutput"><span class="special"><</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">></span></code></a></span></dt>
|
||
</dl></div>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h5 class="title">
|
||
<a name="thread.parallel.ref.v2.concepts"></a><a class="link" href="parallel.html#thread.parallel.ref.v2.concepts" title="Concepts">Concepts</a>
|
||
</h5></div></div></div>
|
||
<div class="section"><div class="titlepage"><div><div><h6 class="title">
|
||
<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
|
||
<code class="computeroutput"><span class="identifier">Region_Callable</span></code></a>
|
||
</h6></div></div></div></div>
|
||
<div class="section"><div class="titlepage"><div><div><h6 class="title">
|
||
<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
|
||
<code class="computeroutput"><span class="identifier">Task_Callable</span></code></a>
|
||
</h6></div></div></div></div>
|
||
</div>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h5 class="title">
|
||
<a name="thread.parallel.ref.v2.task_region"></a><a class="link" href="parallel.html#thread.parallel.ref.v2.task_region" title="Header <experimental/task_region.hpp>">Header <code class="computeroutput"><span class="special"><</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">></span></code></a>
|
||
</h5></div></div></div>
|
||
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">namespace</span> <span class="identifier">experimental</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">namespace</span> <span class="identifier">parallel</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">inline</span> <span class="keyword">namespace</span> <span class="identifier">v2</span>
|
||
<span class="special">{</span>
|
||
|
||
<span class="keyword">class</span> <span class="identifier">task_canceled_exception</span><span class="special">;</span>
|
||
|
||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Executor</span><span class="special">></span>
|
||
<span class="keyword">class</span> <span class="identifier">task_region_handle_gen</span><span class="special">;</span>
|
||
|
||
<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>
|
||
|
||
<span class="keyword">class</span> <span class="identifier">task_region_handle</span><span class="special">;</span>
|
||
|
||
<span class="keyword">template</span> <span class="special"><</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">></span>
|
||
<span class="keyword">void</span> <span class="identifier">task_region_final</span><span class="special">(</span><span class="identifier">Executor</span><span class="special">&</span> <span class="identifier">ex</span><span class="special">,</span> <span class="identifier">F</span><span class="special">&&</span> <span class="identifier">f</span><span class="special">);</span>
|
||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">F</span><span class="special">></span>
|
||
<span class="keyword">void</span> <span class="identifier">task_region_final</span><span class="special">(</span><span class="identifier">F</span><span class="special">&&</span> <span class="identifier">f</span><span class="special">);</span>
|
||
|
||
<span class="keyword">template</span> <span class="special"><</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">></span>
|
||
<span class="keyword">void</span> <span class="identifier">task_region</span><span class="special">(</span><span class="identifier">Executor</span><span class="special">&</span> <span class="identifier">ex</span><span class="special">,</span> <span class="identifier">F</span><span class="special">&&</span> <span class="identifier">f</span><span class="special">);</span>
|
||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">F</span><span class="special">></span>
|
||
<span class="keyword">void</span> <span class="identifier">task_region</span><span class="special">(</span><span class="identifier">F</span><span class="special">&&</span> <span class="identifier">f</span><span class="special">);</span>
|
||
|
||
<span class="special">}</span> <span class="comment">// v2</span>
|
||
<span class="special">}</span> <span class="comment">// parallel</span>
|
||
<span class="special">}</span> <span class="comment">// experimental</span>
|
||
<span class="special">}</span> <span class="comment">// boost</span>
|
||
</pre>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h6 class="title">
|
||
<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
|
||
<code class="computeroutput"><span class="identifier">task_canceled_exception</span> </code></a>
|
||
</h6></div></div></div>
|
||
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">namespace</span> <span class="identifier">experimental</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">namespace</span> <span class="identifier">parallel</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">inline</span> <span class="keyword">namespace</span> <span class="identifier">v2</span>
|
||
<span class="special">{</span>
|
||
|
||
<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>
|
||
<span class="special">{</span>
|
||
<span class="keyword">public</span><span class="special">:</span>
|
||
<span class="identifier">task_canceled_exception</span><span class="special">()</span> <span class="keyword">noexcept</span><span class="special">;</span>
|
||
<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">&)</span> <span class="keyword">noexcept</span><span class="special">;</span>
|
||
<span class="identifier">task_canceled_exception</span><span class="special">&</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">&)</span> <span class="keyword">noexcept</span><span class="special">;</span>
|
||
<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>
|
||
<span class="special">};</span>
|
||
|
||
<span class="special">}</span> <span class="comment">// v2</span>
|
||
<span class="special">}</span> <span class="comment">// parallel</span>
|
||
<span class="special">}</span> <span class="comment">// experimental</span>
|
||
<span class="special">}</span> <span class="comment">// boost</span>
|
||
</pre>
|
||
</div>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h6 class="title">
|
||
<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<>">Template
|
||
Class <code class="computeroutput"><span class="identifier">task_region_handle_gen</span><span class="special"><></span></code></a>
|
||
</h6></div></div></div>
|
||
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">namespace</span> <span class="identifier">experimental</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">namespace</span> <span class="identifier">parallel</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">inline</span> <span class="keyword">namespace</span> <span class="identifier">v2</span>
|
||
<span class="special">{</span>
|
||
|
||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Executor</span><span class="special">></span>
|
||
<span class="keyword">class</span> <span class="identifier">task_region_handle_gen</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">protected</span><span class="special">:</span>
|
||
<span class="identifier">task_region_handle_gen</span><span class="special">(</span><span class="identifier">Executor</span><span class="special">&</span> <span class="identifier">ex</span><span class="special">);</span>
|
||
|
||
<span class="special">~</span><span class="identifier">task_region_handle_gen</span><span class="special">();</span>
|
||
|
||
<span class="keyword">public</span><span class="special">:</span>
|
||
<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">&)</span> <span class="special">=</span> <span class="keyword">delete</span><span class="special">;</span>
|
||
<span class="identifier">task_region_handle_gen</span><span class="special">&</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">&)</span> <span class="special">=</span> <span class="keyword">delete</span><span class="special">;</span>
|
||
<span class="identifier">task_region_handle_gen</span><span class="special">*</span> <span class="keyword">operator</span><span class="special">&()</span> <span class="keyword">const</span> <span class="special">=</span> <span class="keyword">delete</span><span class="special">;</span>
|
||
|
||
<span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">F</span><span class="special">></span>
|
||
<span class="keyword">void</span> <span class="identifier">run</span><span class="special">(</span><span class="identifier">F</span><span class="special">&&</span> <span class="identifier">f</span><span class="special">);</span>
|
||
|
||
<span class="keyword">void</span> <span class="identifier">wait</span><span class="special">();</span>
|
||
<span class="special">};</span>
|
||
|
||
<span class="special">}</span> <span class="comment">// v2</span>
|
||
<span class="special">}</span> <span class="comment">// parallel</span>
|
||
<span class="special">}</span> <span class="comment">// experimental</span>
|
||
<span class="special">}</span> <span class="comment">// boost</span>
|
||
</pre>
|
||
</div>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h6 class="title">
|
||
<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
|
||
<code class="computeroutput"><span class="identifier">default_executor</span> </code></a>
|
||
</h6></div></div></div>
|
||
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">namespace</span> <span class="identifier">experimental</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">namespace</span> <span class="identifier">parallel</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">inline</span> <span class="keyword">namespace</span> <span class="identifier">v2</span>
|
||
<span class="special">{</span>
|
||
|
||
<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>
|
||
|
||
<span class="special">}</span> <span class="comment">// v2</span>
|
||
<span class="special">}</span> <span class="comment">// parallel</span>
|
||
<span class="special">}</span> <span class="comment">// experimental</span>
|
||
<span class="special">}</span> <span class="comment">// boost</span>
|
||
</pre>
|
||
</div>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h6 class="title">
|
||
<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
|
||
<code class="computeroutput"><span class="identifier">task_region_handle</span> </code></a>
|
||
</h6></div></div></div>
|
||
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">namespace</span> <span class="identifier">experimental</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">namespace</span> <span class="identifier">parallel</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">inline</span> <span class="keyword">namespace</span> <span class="identifier">v2</span>
|
||
<span class="special">{</span>
|
||
|
||
<span class="keyword">class</span> <span class="identifier">task_region_handle</span> <span class="special">:</span>
|
||
<span class="keyword">public</span> <span class="identifier">task_region_handle_gen</span><span class="special"><</span><span class="identifier">default_executor</span><span class="special">></span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">protected</span><span class="special">:</span>
|
||
<span class="identifier">task_region_handle</span><span class="special">();</span>
|
||
<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">&)</span> <span class="special">=</span> <span class="keyword">delete</span><span class="special">;</span>
|
||
<span class="identifier">task_region_handle</span><span class="special">&</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">&)</span> <span class="special">=</span> <span class="keyword">delete</span><span class="special">;</span>
|
||
<span class="identifier">task_region_handle</span><span class="special">*</span> <span class="keyword">operator</span><span class="special">&()</span> <span class="keyword">const</span> <span class="special">=</span> <span class="keyword">delete</span><span class="special">;</span>
|
||
|
||
<span class="special">};</span>
|
||
|
||
<span class="special">}</span> <span class="comment">// v2</span>
|
||
<span class="special">}</span> <span class="comment">// parallel</span>
|
||
<span class="special">}</span> <span class="comment">// experimental</span>
|
||
<span class="special">}</span> <span class="comment">// boost</span>
|
||
</pre>
|
||
</div>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h6 class="title">
|
||
<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
|
||
Function <code class="computeroutput"><span class="identifier">task_region_final</span>
|
||
</code></a>
|
||
</h6></div></div></div>
|
||
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">namespace</span> <span class="identifier">experimental</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">namespace</span> <span class="identifier">parallel</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">inline</span> <span class="keyword">namespace</span> <span class="identifier">v2</span>
|
||
<span class="special">{</span>
|
||
|
||
<span class="keyword">template</span> <span class="special"><</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">></span>
|
||
<span class="keyword">void</span> <span class="identifier">task_region_final</span><span class="special">(</span><span class="identifier">Executor</span><span class="special">&</span> <span class="identifier">ex</span><span class="special">,</span> <span class="identifier">F</span><span class="special">&&</span> <span class="identifier">f</span><span class="special">);</span>
|
||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">F</span><span class="special">></span>
|
||
<span class="keyword">void</span> <span class="identifier">task_region_final</span><span class="special">(</span><span class="identifier">F</span><span class="special">&&</span> <span class="identifier">f</span><span class="special">);</span>
|
||
|
||
<span class="special">}</span> <span class="comment">// v2</span>
|
||
<span class="special">}</span> <span class="comment">// parallel</span>
|
||
<span class="special">}</span> <span class="comment">// experimental</span>
|
||
<span class="special">}</span> <span class="comment">// boost</span>
|
||
</pre>
|
||
</div>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h6 class="title">
|
||
<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
|
||
Function <code class="computeroutput"><span class="identifier">task_region</span> </code></a>
|
||
</h6></div></div></div>
|
||
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">namespace</span> <span class="identifier">experimental</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">namespace</span> <span class="identifier">parallel</span>
|
||
<span class="special">{</span>
|
||
<span class="keyword">inline</span> <span class="keyword">namespace</span> <span class="identifier">v2</span>
|
||
<span class="special">{</span>
|
||
|
||
<span class="keyword">template</span> <span class="special"><</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">></span>
|
||
<span class="keyword">void</span> <span class="identifier">task_region</span><span class="special">(</span><span class="identifier">Executor</span><span class="special">&</span> <span class="identifier">ex</span><span class="special">,</span> <span class="identifier">F</span><span class="special">&&</span> <span class="identifier">f</span><span class="special">);</span>
|
||
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">F</span><span class="special">></span>
|
||
<span class="keyword">void</span> <span class="identifier">task_region</span><span class="special">(</span><span class="identifier">F</span><span class="special">&&</span> <span class="identifier">f</span><span class="special">);</span>
|
||
|
||
<span class="special">}</span> <span class="comment">// v2</span>
|
||
<span class="special">}</span> <span class="comment">// parallel</span>
|
||
<span class="special">}</span> <span class="comment">// experimental</span>
|
||
<span class="special">}</span> <span class="comment">// boost</span>
|
||
</pre>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||
<td align="left"></td>
|
||
<td align="right"><div class="copyright-footer">Copyright © 2007 -11 Anthony Williams<br>Copyright © 2011 -17 Vicente J. Botet Escriba<p>
|
||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||
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>)
|
||
</p>
|
||
</div></td>
|
||
</tr></table>
|
||
<hr>
|
||
<div class="spirit-nav">
|
||
<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>
|
||
</div>
|
||
</body>
|
||
</html>
|