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

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
  3. <title>tbb::interface6::task_arena Class Reference</title>
  4. <link href="doxygen.css" rel="stylesheet" type="text/css">
  5. <link href="tabs.css" rel="stylesheet" type="text/css">
  6. </head><body>
  7. <!-- Generated by Doxygen 1.4.7 -->
  8. <div class="tabs">
  9. <ul>
  10. <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
  11. <li><a href="modules.html"><span>Modules</span></a></li>
  12. <li><a href="namespaces.html"><span>Namespaces</span></a></li>
  13. <li id="current"><a href="annotated.html"><span>Classes</span></a></li>
  14. <li><a href="files.html"><span>Files</span></a></li>
  15. <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
  16. </ul></div>
  17. <div class="tabs">
  18. <ul>
  19. <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
  20. <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
  21. <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
  22. </ul></div>
  23. <div class="nav">
  24. <a class="el" href="a00428.html">tbb</a>::<b>interface6</b>::<a class="el" href="a00350.html">task_arena</a></div>
  25. <h1>tbb::interface6::task_arena Class Reference</h1><!-- doxytag: class="tbb::interface6::task_arena" --><code>#include &lt;task_arena.h&gt;</code>
  26. <p>
  27. <a href="a00138.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
  28. <tr><td></td></tr>
  29. <tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
  30. <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>
  31. <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>
  32. <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)" -->
  33. &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>
  34. <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>
  35. <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="()" -->
  36. void&nbsp;</td><td class="memItemRight" valign="bottom"><b>initialize</b> ()</td></tr>
  37. <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)" -->
  38. 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>
  39. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Overrides concurrency level and forces initialization of internal representation. <br></td></tr>
  40. <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>
  41. <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>
  42. <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>
  43. <tr><td class="memTemplParams" nowrap colspan="2">template&lt;typename F&gt; </td></tr>
  44. <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>
  45. <tr><td class="memTemplParams" nowrap colspan="2">template&lt;typename F&gt; </td></tr>
  46. <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>
  47. <tr><td class="memTemplParams" nowrap colspan="2">template&lt;typename F&gt; </td></tr>
  48. <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>
  49. <tr><td class="memTemplParams" nowrap colspan="2">template&lt;typename F&gt; </td></tr>
  50. <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>
  51. <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>
  52. <tr><td colspan="2"><br><h2>Static Public Member Functions</h2></td></tr>
  53. <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="()" -->
  54. static int __TBB_EXPORTED_FUNC&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00350.html#e734de6a5f4a0bd4461c0cbdaa29b6ce">current_slot</a> ()</td></tr>
  55. <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>
  56. <tr><td colspan="2"><br><h2>Static Public Attributes</h2></td></tr>
  57. <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="" -->
  58. static const int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00350.html#fa26370c094032900c1ed69d8e92f4e8">automatic</a> = -1</td></tr>
  59. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Typedef for number of threads that is automatic. <br></td></tr>
  60. <tr><td colspan="2"><br><h2>Friends</h2></td></tr>
  61. <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="" -->
  62. class&nbsp;</td><td class="memItemRight" valign="bottom"><b>internal::task_scheduler_observer_v3</b></td></tr>
  63. </table>
  64. <hr><a name="_details"></a><h2>Detailed Description</h2>
  65. 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.
  66. <p>
  67. <hr><h2>Constructor &amp; Destructor Documentation</h2>
  68. <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)" -->
  69. <div class="memitem">
  70. <div class="memproto">
  71. <table class="memname">
  72. <tr>
  73. <td class="memname">tbb::interface6::task_arena::task_arena </td>
  74. <td>(</td>
  75. <td class="paramtype">int&nbsp;</td>
  76. <td class="paramname"> <em>max_concurrency</em> = <code><a class="el" href="a00350.html#fa26370c094032900c1ed69d8e92f4e8">automatic</a></code>, </td>
  77. </tr>
  78. <tr>
  79. <td class="paramkey"></td>
  80. <td></td>
  81. <td class="paramtype">unsigned&nbsp;</td>
  82. <td class="paramname"> <em>reserved_for_masters</em> = <code>1</code></td><td>&nbsp;</td>
  83. </tr>
  84. <tr>
  85. <td></td>
  86. <td>)</td>
  87. <td></td><td></td><td width="100%"><code> [inline]</code></td>
  88. </tr>
  89. </table>
  90. </div>
  91. <div class="memdoc">
  92. <p>
  93. Creates <a class="el" href="a00350.html">task_arena</a> with certain concurrency limits.
  94. <p>
  95. <ul>
  96. <li>max_concurrency specifies total number of slots in arena where threads work </li>
  97. <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>
  98. </ul>
  99. </div>
  100. </div><p>
  101. <a class="anchor" name="fec24e9b3fa07a6e7b20add7c7e0a660"></a><!-- doxytag: member="tbb::interface6::task_arena::~task_arena" ref="fec24e9b3fa07a6e7b20add7c7e0a660" args="()" -->
  102. <div class="memitem">
  103. <div class="memproto">
  104. <table class="memname">
  105. <tr>
  106. <td class="memname">tbb::interface6::task_arena::~task_arena </td>
  107. <td>(</td>
  108. <td class="paramname"> </td>
  109. <td>&nbsp;)&nbsp;</td>
  110. <td width="100%"><code> [inline]</code></td>
  111. </tr>
  112. </table>
  113. </div>
  114. <div class="memdoc">
  115. <p>
  116. Removes the reference to the internal arena representation, and destroys the external object. Not thread safe wrt concurrent invocations of other methods.
  117. </div>
  118. </div><p>
  119. <hr><h2>Member Function Documentation</h2>
  120. <a class="anchor" name="780277a89e35868abdec843fecaa2237"></a><!-- doxytag: member="tbb::interface6::task_arena::enqueue" ref="780277a89e35868abdec843fecaa2237" args="(const F &amp;f, priority_t p)" -->
  121. <div class="memitem">
  122. <div class="memproto">
  123. <div class="memtemplate">
  124. template&lt;typename F&gt; </div>
  125. <table class="memname">
  126. <tr>
  127. <td class="memname">void tbb::interface6::task_arena::enqueue </td>
  128. <td>(</td>
  129. <td class="paramtype">const F &amp;&nbsp;</td>
  130. <td class="paramname"> <em>f</em>, </td>
  131. </tr>
  132. <tr>
  133. <td class="paramkey"></td>
  134. <td></td>
  135. <td class="paramtype">priority_t&nbsp;</td>
  136. <td class="paramname"> <em>p</em></td><td>&nbsp;</td>
  137. </tr>
  138. <tr>
  139. <td></td>
  140. <td>)</td>
  141. <td></td><td></td><td width="100%"><code> [inline]</code></td>
  142. </tr>
  143. </table>
  144. </div>
  145. <div class="memdoc">
  146. <p>
  147. 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
  148. </div>
  149. </div><p>
  150. <a class="anchor" name="11e3854e92c842ee7d72a7f83d416896"></a><!-- doxytag: member="tbb::interface6::task_arena::enqueue" ref="11e3854e92c842ee7d72a7f83d416896" args="(const F &amp;f)" -->
  151. <div class="memitem">
  152. <div class="memproto">
  153. <div class="memtemplate">
  154. template&lt;typename F&gt; </div>
  155. <table class="memname">
  156. <tr>
  157. <td class="memname">void tbb::interface6::task_arena::enqueue </td>
  158. <td>(</td>
  159. <td class="paramtype">const F &amp;&nbsp;</td>
  160. <td class="paramname"> <em>f</em> </td>
  161. <td>&nbsp;)&nbsp;</td>
  162. <td width="100%"><code> [inline]</code></td>
  163. </tr>
  164. </table>
  165. </div>
  166. <div class="memdoc">
  167. <p>
  168. Enqueues a task into the arena to process a functor, and immediately returns. Does not require the calling thread to join the arena
  169. </div>
  170. </div><p>
  171. <a class="anchor" name="082803bb20347e64fed2c11db8e9670e"></a><!-- doxytag: member="tbb::interface6::task_arena::execute" ref="082803bb20347e64fed2c11db8e9670e" args="(const F &amp;f)" -->
  172. <div class="memitem">
  173. <div class="memproto">
  174. <div class="memtemplate">
  175. template&lt;typename F&gt; </div>
  176. <table class="memname">
  177. <tr>
  178. <td class="memname">void tbb::interface6::task_arena::execute </td>
  179. <td>(</td>
  180. <td class="paramtype">const F &amp;&nbsp;</td>
  181. <td class="paramname"> <em>f</em> </td>
  182. <td>&nbsp;)&nbsp;</td>
  183. <td width="100%"><code> [inline]</code></td>
  184. </tr>
  185. </table>
  186. </div>
  187. <div class="memdoc">
  188. <p>
  189. 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
  190. </div>
  191. </div><p>
  192. <a class="anchor" name="1e013b96178a79c57ec7846ea2cf5e2e"></a><!-- doxytag: member="tbb::interface6::task_arena::execute" ref="1e013b96178a79c57ec7846ea2cf5e2e" args="(F &amp;f)" -->
  193. <div class="memitem">
  194. <div class="memproto">
  195. <div class="memtemplate">
  196. template&lt;typename F&gt; </div>
  197. <table class="memname">
  198. <tr>
  199. <td class="memname">void tbb::interface6::task_arena::execute </td>
  200. <td>(</td>
  201. <td class="paramtype">F &amp;&nbsp;</td>
  202. <td class="paramname"> <em>f</em> </td>
  203. <td>&nbsp;)&nbsp;</td>
  204. <td width="100%"><code> [inline]</code></td>
  205. </tr>
  206. </table>
  207. </div>
  208. <div class="memdoc">
  209. <p>
  210. 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
  211. </div>
  212. </div><p>
  213. <a class="anchor" name="11e35391bf67e96f877183659106583d"></a><!-- doxytag: member="tbb::interface6::task_arena::is_active" ref="11e35391bf67e96f877183659106583d" args="() const " -->
  214. <div class="memitem">
  215. <div class="memproto">
  216. <table class="memname">
  217. <tr>
  218. <td class="memname">bool tbb::interface6::task_arena::is_active </td>
  219. <td>(</td>
  220. <td class="paramname"> </td>
  221. <td>&nbsp;)&nbsp;</td>
  222. <td width="100%"> const<code> [inline]</code></td>
  223. </tr>
  224. </table>
  225. </div>
  226. <div class="memdoc">
  227. <p>
  228. 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.
  229. </div>
  230. </div><p>
  231. <a class="anchor" name="ee3f3f736da03bfe8b82acfa822624a6"></a><!-- doxytag: member="tbb::interface6::task_arena::terminate" ref="ee3f3f736da03bfe8b82acfa822624a6" args="()" -->
  232. <div class="memitem">
  233. <div class="memproto">
  234. <table class="memname">
  235. <tr>
  236. <td class="memname">void tbb::interface6::task_arena::terminate </td>
  237. <td>(</td>
  238. <td class="paramname"> </td>
  239. <td>&nbsp;)&nbsp;</td>
  240. <td width="100%"><code> [inline]</code></td>
  241. </tr>
  242. </table>
  243. </div>
  244. <div class="memdoc">
  245. <p>
  246. Removes the reference to the internal arena representation. Not thread safe wrt concurrent invocations of other methods.
  247. </div>
  248. </div><p>
  249. <a class="anchor" name="776e73ba196e5bbb8b8ed489fc2b77d3"></a><!-- doxytag: member="tbb::interface6::task_arena::wait_until_empty" ref="776e73ba196e5bbb8b8ed489fc2b77d3" args="()" -->
  250. <div class="memitem">
  251. <div class="memproto">
  252. <table class="memname">
  253. <tr>
  254. <td class="memname">void tbb::interface6::task_arena::wait_until_empty </td>
  255. <td>(</td>
  256. <td class="paramname"> </td>
  257. <td>&nbsp;)&nbsp;</td>
  258. <td width="100%"><code> [inline]</code></td>
  259. </tr>
  260. </table>
  261. </div>
  262. <div class="memdoc">
  263. <p>
  264. 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>)
  265. </div>
  266. </div><p>
  267. <hr>The documentation for this class was generated from the following file:<ul>
  268. <li>task_arena.h</ul>
  269. <hr>
  270. <p></p>
  271. Copyright &copy; 2005-2013 Intel Corporation. All Rights Reserved.
  272. <p></p>
  273. Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are
  274. registered trademarks or trademarks of Intel Corporation or its
  275. subsidiaries in the United States and other countries.
  276. <p></p>
  277. * Other names and brands may be claimed as the property of others.