You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

302 lines
17 KiB

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>tbb::interface6::task_arena Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.7 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li id="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
<li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
</ul></div>
<div class="nav">
<a class="el" href="a00428.html">tbb</a>::<b>interface6</b>::<a class="el" href="a00350.html">task_arena</a></div>
<h1>tbb::interface6::task_arena Class Reference</h1><!-- doxytag: class="tbb::interface6::task_arena" --><code>#include &lt;task_arena.h&gt;</code>
<p>
<a href="a00138.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00350.html#5e14461dfcbc713df95367cf7f44738f">task_arena</a> (int max_concurrency=<a class="el" href="a00350.html#fa26370c094032900c1ed69d8e92f4e8">automatic</a>, unsigned reserved_for_masters=1)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Creates <a class="el" href="a00350.html">task_arena</a> with certain concurrency limits. <a href="#5e14461dfcbc713df95367cf7f44738f"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="27ac2706e3f2a989487ba7944b07cb94"></a><!-- doxytag: member="tbb::interface6::task_arena::task_arena" ref="27ac2706e3f2a989487ba7944b07cb94" args="(const task_arena &amp;s)" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00350.html#27ac2706e3f2a989487ba7944b07cb94">task_arena</a> (const <a class="el" href="a00350.html">task_arena</a> &amp;s)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Copies settings from another <a class="el" href="a00350.html">task_arena</a>. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="797b8499b58cf6d883f04bacb7d96644"></a><!-- doxytag: member="tbb::interface6::task_arena::initialize" ref="797b8499b58cf6d883f04bacb7d96644" args="()" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><b>initialize</b> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="ff36aa5ec1305ca9931396fa608981da"></a><!-- doxytag: member="tbb::interface6::task_arena::initialize" ref="ff36aa5ec1305ca9931396fa608981da" args="(int max_concurrency, unsigned reserved_for_masters=1)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00350.html#ff36aa5ec1305ca9931396fa608981da">initialize</a> (int max_concurrency, unsigned reserved_for_masters=1)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Overrides concurrency level and forces initialization of internal representation. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00350.html#ee3f3f736da03bfe8b82acfa822624a6">terminate</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00350.html#fec24e9b3fa07a6e7b20add7c7e0a660">~task_arena</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00350.html#11e35391bf67e96f877183659106583d">is_active</a> () const </td></tr>
<tr><td class="memTemplParams" nowrap colspan="2">template&lt;typename F&gt; </td></tr>
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00350.html#11e3854e92c842ee7d72a7f83d416896">enqueue</a> (const F &amp;f)</td></tr>
<tr><td class="memTemplParams" nowrap colspan="2">template&lt;typename F&gt; </td></tr>
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00350.html#780277a89e35868abdec843fecaa2237">enqueue</a> (const F &amp;f, priority_t p)</td></tr>
<tr><td class="memTemplParams" nowrap colspan="2">template&lt;typename F&gt; </td></tr>
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00350.html#1e013b96178a79c57ec7846ea2cf5e2e">execute</a> (F &amp;f)</td></tr>
<tr><td class="memTemplParams" nowrap colspan="2">template&lt;typename F&gt; </td></tr>
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00350.html#082803bb20347e64fed2c11db8e9670e">execute</a> (const F &amp;f)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00350.html#776e73ba196e5bbb8b8ed489fc2b77d3">wait_until_empty</a> ()</td></tr>
<tr><td colspan="2"><br><h2>Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="e734de6a5f4a0bd4461c0cbdaa29b6ce"></a><!-- doxytag: member="tbb::interface6::task_arena::current_slot" ref="e734de6a5f4a0bd4461c0cbdaa29b6ce" args="()" -->
static int __TBB_EXPORTED_FUNC&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00350.html#e734de6a5f4a0bd4461c0cbdaa29b6ce">current_slot</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the index, aka slot number, of the calling thread in its current arena. <br></td></tr>
<tr><td colspan="2"><br><h2>Static Public Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="fa26370c094032900c1ed69d8e92f4e8"></a><!-- doxytag: member="tbb::interface6::task_arena::automatic" ref="fa26370c094032900c1ed69d8e92f4e8" args="" -->
static const int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00350.html#fa26370c094032900c1ed69d8e92f4e8">automatic</a> = -1</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Typedef for number of threads that is automatic. <br></td></tr>
<tr><td colspan="2"><br><h2>Friends</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="cd0464c9e70fd5fd79f1c8a875ca2849"></a><!-- doxytag: member="tbb::interface6::task_arena::internal::task_scheduler_observer_v3" ref="cd0464c9e70fd5fd79f1c8a875ca2849" args="" -->
class&nbsp;</td><td class="memItemRight" valign="bottom"><b>internal::task_scheduler_observer_v3</b></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
1-to-1 proxy representation class of scheduler's arena Constructors set up settings only, real construction is deferred till the first method invocation TODO: A side effect of this is that it's impossible to create a const <a class="el" href="a00350.html">task_arena</a> object. Rethink? Destructor only removes one of the references to the inner arena representation. Final destruction happens when all the references (and the work) are gone.
<p>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="5e14461dfcbc713df95367cf7f44738f"></a><!-- doxytag: member="tbb::interface6::task_arena::task_arena" ref="5e14461dfcbc713df95367cf7f44738f" args="(int max_concurrency=automatic, unsigned reserved_for_masters=1)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">tbb::interface6::task_arena::task_arena </td>
<td>(</td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>max_concurrency</em> = <code><a class="el" href="a00350.html#fa26370c094032900c1ed69d8e92f4e8">automatic</a></code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned&nbsp;</td>
<td class="paramname"> <em>reserved_for_masters</em> = <code>1</code></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Creates <a class="el" href="a00350.html">task_arena</a> with certain concurrency limits.
<p>
<ul>
<li>max_concurrency specifies total number of slots in arena where threads work </li>
<li>reserved_for_masters specifies number of slots to be used by master threads only. Value of 1 is default and reflects behavior of implicit arenas. </li>
</ul>
</div>
</div><p>
<a class="anchor" name="fec24e9b3fa07a6e7b20add7c7e0a660"></a><!-- doxytag: member="tbb::interface6::task_arena::~task_arena" ref="fec24e9b3fa07a6e7b20add7c7e0a660" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">tbb::interface6::task_arena::~task_arena </td>
<td>(</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Removes the reference to the internal arena representation, and destroys the external object. Not thread safe wrt concurrent invocations of other methods.
</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="780277a89e35868abdec843fecaa2237"></a><!-- doxytag: member="tbb::interface6::task_arena::enqueue" ref="780277a89e35868abdec843fecaa2237" args="(const F &amp;f, priority_t p)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename F&gt; </div>
<table class="memname">
<tr>
<td class="memname">void tbb::interface6::task_arena::enqueue </td>
<td>(</td>
<td class="paramtype">const F &amp;&nbsp;</td>
<td class="paramname"> <em>f</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">priority_t&nbsp;</td>
<td class="paramname"> <em>p</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td width="100%"><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Enqueues a task with priority p into the arena to process a functor f, and immediately returns. Does not require the calling thread to join the arena
</div>
</div><p>
<a class="anchor" name="11e3854e92c842ee7d72a7f83d416896"></a><!-- doxytag: member="tbb::interface6::task_arena::enqueue" ref="11e3854e92c842ee7d72a7f83d416896" args="(const F &amp;f)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename F&gt; </div>
<table class="memname">
<tr>
<td class="memname">void tbb::interface6::task_arena::enqueue </td>
<td>(</td>
<td class="paramtype">const F &amp;&nbsp;</td>
<td class="paramname"> <em>f</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Enqueues a task into the arena to process a functor, and immediately returns. Does not require the calling thread to join the arena
</div>
</div><p>
<a class="anchor" name="082803bb20347e64fed2c11db8e9670e"></a><!-- doxytag: member="tbb::interface6::task_arena::execute" ref="082803bb20347e64fed2c11db8e9670e" args="(const F &amp;f)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename F&gt; </div>
<table class="memname">
<tr>
<td class="memname">void tbb::interface6::task_arena::execute </td>
<td>(</td>
<td class="paramtype">const F &amp;&nbsp;</td>
<td class="paramname"> <em>f</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Joins the arena and executes a functor, then returns If not possible to join, wraps the functor into a task, enqueues it and waits for task completion Can decrement the arena demand for workers, causing a worker to leave and free a slot to the calling thread
</div>
</div><p>
<a class="anchor" name="1e013b96178a79c57ec7846ea2cf5e2e"></a><!-- doxytag: member="tbb::interface6::task_arena::execute" ref="1e013b96178a79c57ec7846ea2cf5e2e" args="(F &amp;f)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename F&gt; </div>
<table class="memname">
<tr>
<td class="memname">void tbb::interface6::task_arena::execute </td>
<td>(</td>
<td class="paramtype">F &amp;&nbsp;</td>
<td class="paramname"> <em>f</em> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Joins the arena and executes a functor, then returns If not possible to join, wraps the functor into a task, enqueues it and waits for task completion Can decrement the arena demand for workers, causing a worker to leave and free a slot to the calling thread
</div>
</div><p>
<a class="anchor" name="11e35391bf67e96f877183659106583d"></a><!-- doxytag: member="tbb::interface6::task_arena::is_active" ref="11e35391bf67e96f877183659106583d" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool tbb::interface6::task_arena::is_active </td>
<td>(</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns true if the arena is active (initialized); false otherwise. The name was chosen to match a <a class="el" href="a00355.html">task_scheduler_init</a> method with the same semantics.
</div>
</div><p>
<a class="anchor" name="ee3f3f736da03bfe8b82acfa822624a6"></a><!-- doxytag: member="tbb::interface6::task_arena::terminate" ref="ee3f3f736da03bfe8b82acfa822624a6" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void tbb::interface6::task_arena::terminate </td>
<td>(</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Removes the reference to the internal arena representation. Not thread safe wrt concurrent invocations of other methods.
</div>
</div><p>
<a class="anchor" name="776e73ba196e5bbb8b8ed489fc2b77d3"></a><!-- doxytag: member="tbb::interface6::task_arena::wait_until_empty" ref="776e73ba196e5bbb8b8ed489fc2b77d3" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void tbb::interface6::task_arena::wait_until_empty </td>
<td>(</td>
<td class="paramname"> </td>
<td>&nbsp;)&nbsp;</td>
<td width="100%"><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Wait for all work in the arena to be completed Even submitted by other application threads Joins arena if/when possible (in the same way as <a class="el" href="a00350.html#1e013b96178a79c57ec7846ea2cf5e2e">execute()</a>)
</div>
</div><p>
<hr>The documentation for this class was generated from the following file:<ul>
<li>task_arena.h</ul>
<hr>
<p></p>
Copyright &copy; 2005-2013 Intel Corporation. All Rights Reserved.
<p></p>
Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are
registered trademarks or trademarks of Intel Corporation or its
subsidiaries in the United States and other countries.
<p></p>
* Other names and brands may be claimed as the property of others.