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.

382 lines
19 KiB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=9"/>
  6. <meta name="generator" content="Doxygen 1.8.4"/>
  7. <title>tbb::interface7::task_arena Class Reference</title>
  8. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  9. <script type="text/javascript" src="jquery.js"></script>
  10. <script type="text/javascript" src="dynsections.js"></script>
  11. <link href="doxygen.css" rel="stylesheet" type="text/css" />
  12. </head>
  13. <body>
  14. <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
  15. <!-- end header part -->
  16. <!-- Generated by Doxygen 1.8.4 -->
  17. <div id="navrow1" class="tabs">
  18. <ul class="tablist">
  19. <li><a href="index.html"><span>Main&#160;Page</span></a></li>
  20. <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
  21. <li><a href="modules.html"><span>Modules</span></a></li>
  22. <li><a href="namespaces.html"><span>Namespaces</span></a></li>
  23. <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
  24. <li><a href="files.html"><span>Files</span></a></li>
  25. </ul>
  26. </div>
  27. <div id="navrow2" class="tabs2">
  28. <ul class="tablist">
  29. <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
  30. <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
  31. <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
  32. </ul>
  33. </div>
  34. <div id="nav-path" class="navpath">
  35. <ul>
  36. <li class="navelem"><a class="el" href="a00222.html">tbb</a></li><li class="navelem"><b>interface7</b></li><li class="navelem"><a class="el" href="a00135.html">task_arena</a></li> </ul>
  37. </div>
  38. </div><!-- top -->
  39. <div class="header">
  40. <div class="summary">
  41. <a href="#pub-methods">Public Member Functions</a> &#124;
  42. <a href="#pub-static-methods">Static Public Member Functions</a> &#124;
  43. <a href="#friends">Friends</a> &#124;
  44. <a href="a00369.html">List of all members</a> </div>
  45. <div class="headertitle">
  46. <div class="title">tbb::interface7::task_arena Class Reference</div> </div>
  47. </div><!--header-->
  48. <div class="contents">
  49. <p><code>#include &lt;task_arena.h&gt;</code></p>
  50. <div class="dynheader">
  51. Inheritance diagram for tbb::interface7::task_arena:</div>
  52. <div class="dyncontent">
  53. <div class="center">
  54. <img src="a00135.png" usemap="#tbb::interface7::task_arena_map" alt=""/>
  55. <map id="tbb::interface7::task_arena_map" name="tbb::interface7::task_arena_map">
  56. </map>
  57. </div></div>
  58. <table class="memberdecls">
  59. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
  60. Public Member Functions</h2></td></tr>
  61. <tr class="memitem:a6035737ce1a8db376d06880dae9d0c40"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00135.html#a6035737ce1a8db376d06880dae9d0c40">task_arena</a> (int max_concurrency=automatic, unsigned reserved_for_masters=1)</td></tr>
  62. <tr class="memdesc:a6035737ce1a8db376d06880dae9d0c40"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates <a class="el" href="a00135.html">task_arena</a> with certain concurrency limits. <a href="#a6035737ce1a8db376d06880dae9d0c40">More...</a><br/></td></tr>
  63. <tr class="separator:a6035737ce1a8db376d06880dae9d0c40"><td class="memSeparator" colspan="2">&#160;</td></tr>
  64. <tr class="memitem:a70d122b3e6e4760c6053c5c230c715ef"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a70d122b3e6e4760c6053c5c230c715ef"></a>
  65. &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00135.html#a70d122b3e6e4760c6053c5c230c715ef">task_arena</a> (const <a class="el" href="a00135.html">task_arena</a> &amp;s)</td></tr>
  66. <tr class="memdesc:a70d122b3e6e4760c6053c5c230c715ef"><td class="mdescLeft">&#160;</td><td class="mdescRight">Copies settings from another <a class="el" href="a00135.html">task_arena</a>. <br/></td></tr>
  67. <tr class="separator:a70d122b3e6e4760c6053c5c230c715ef"><td class="memSeparator" colspan="2">&#160;</td></tr>
  68. <tr class="memitem:a955131a79f8dc5a0a5c9ffa66a7e7140"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a955131a79f8dc5a0a5c9ffa66a7e7140"></a>
  69. void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00135.html#a955131a79f8dc5a0a5c9ffa66a7e7140">initialize</a> ()</td></tr>
  70. <tr class="memdesc:a955131a79f8dc5a0a5c9ffa66a7e7140"><td class="mdescLeft">&#160;</td><td class="mdescRight">Forces allocation of the resources for the <a class="el" href="a00135.html">task_arena</a> as specified in constructor arguments. <br/></td></tr>
  71. <tr class="separator:a955131a79f8dc5a0a5c9ffa66a7e7140"><td class="memSeparator" colspan="2">&#160;</td></tr>
  72. <tr class="memitem:a754d60ba6981461eb7c86afd14d3da2a"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a754d60ba6981461eb7c86afd14d3da2a"></a>
  73. void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00135.html#a754d60ba6981461eb7c86afd14d3da2a">initialize</a> (int max_concurrency, unsigned reserved_for_masters=1)</td></tr>
  74. <tr class="memdesc:a754d60ba6981461eb7c86afd14d3da2a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Overrides concurrency level and forces initialization of internal representation. <br/></td></tr>
  75. <tr class="separator:a754d60ba6981461eb7c86afd14d3da2a"><td class="memSeparator" colspan="2">&#160;</td></tr>
  76. <tr class="memitem:aecb3eedeacfe8469a91c17525dae7fc9"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00135.html#aecb3eedeacfe8469a91c17525dae7fc9">terminate</a> ()</td></tr>
  77. <tr class="separator:aecb3eedeacfe8469a91c17525dae7fc9"><td class="memSeparator" colspan="2">&#160;</td></tr>
  78. <tr class="memitem:a9ff5a35a219953a4f3d99b833fa5f683"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00135.html#a9ff5a35a219953a4f3d99b833fa5f683">~task_arena</a> ()</td></tr>
  79. <tr class="separator:a9ff5a35a219953a4f3d99b833fa5f683"><td class="memSeparator" colspan="2">&#160;</td></tr>
  80. <tr class="memitem:ad85856cefa30d42155a2b122b03efd8c"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00135.html#ad85856cefa30d42155a2b122b03efd8c">is_active</a> () const </td></tr>
  81. <tr class="separator:ad85856cefa30d42155a2b122b03efd8c"><td class="memSeparator" colspan="2">&#160;</td></tr>
  82. <tr class="memitem:a8034275ed2fffa68f70484043b90d406"><td class="memTemplParams" colspan="2">template&lt;typename F &gt; </td></tr>
  83. <tr class="memitem:a8034275ed2fffa68f70484043b90d406"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00135.html#a8034275ed2fffa68f70484043b90d406">enqueue</a> (const F &amp;f)</td></tr>
  84. <tr class="separator:a8034275ed2fffa68f70484043b90d406"><td class="memSeparator" colspan="2">&#160;</td></tr>
  85. <tr class="memitem:a9a04ab4afb2d74b0317618f59ab49be7"><td class="memTemplParams" colspan="2">template&lt;typename F &gt; </td></tr>
  86. <tr class="memitem:a9a04ab4afb2d74b0317618f59ab49be7"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00135.html#a9a04ab4afb2d74b0317618f59ab49be7">enqueue</a> (const F &amp;f, priority_t p)</td></tr>
  87. <tr class="separator:a9a04ab4afb2d74b0317618f59ab49be7"><td class="memSeparator" colspan="2">&#160;</td></tr>
  88. <tr class="memitem:af0c96f325b59d567b4c720f2830adde8"><td class="memTemplParams" colspan="2">template&lt;typename F &gt; </td></tr>
  89. <tr class="memitem:af0c96f325b59d567b4c720f2830adde8"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00135.html#af0c96f325b59d567b4c720f2830adde8">execute</a> (F &amp;f)</td></tr>
  90. <tr class="separator:af0c96f325b59d567b4c720f2830adde8"><td class="memSeparator" colspan="2">&#160;</td></tr>
  91. <tr class="memitem:ab8442c8e9e3e678349409e08cabc7ae2"><td class="memTemplParams" colspan="2">template&lt;typename F &gt; </td></tr>
  92. <tr class="memitem:ab8442c8e9e3e678349409e08cabc7ae2"><td class="memTemplItemLeft" align="right" valign="top">void&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="a00135.html#ab8442c8e9e3e678349409e08cabc7ae2">execute</a> (const F &amp;f)</td></tr>
  93. <tr class="separator:ab8442c8e9e3e678349409e08cabc7ae2"><td class="memSeparator" colspan="2">&#160;</td></tr>
  94. <tr class="memitem:a07d87dff8c6116ee349684e10f754aeb"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00135.html#a07d87dff8c6116ee349684e10f754aeb">debug_wait_until_empty</a> ()</td></tr>
  95. <tr class="separator:a07d87dff8c6116ee349684e10f754aeb"><td class="memSeparator" colspan="2">&#160;</td></tr>
  96. </table><table class="memberdecls">
  97. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
  98. Static Public Member Functions</h2></td></tr>
  99. <tr class="memitem:a4c107b6a4cc79183923fe2433d25644f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4c107b6a4cc79183923fe2433d25644f"></a>
  100. static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00135.html#a4c107b6a4cc79183923fe2433d25644f">current_slot</a> ()</td></tr>
  101. <tr class="memdesc:a4c107b6a4cc79183923fe2433d25644f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the index, aka slot number, of the calling thread in its current arena. <br/></td></tr>
  102. <tr class="separator:a4c107b6a4cc79183923fe2433d25644f"><td class="memSeparator" colspan="2">&#160;</td></tr>
  103. </table><table class="memberdecls">
  104. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="friends"></a>
  105. Friends</h2></td></tr>
  106. <tr class="memitem:a6887d06dd0f104ab6c06fdddca4d2471"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6887d06dd0f104ab6c06fdddca4d2471"></a>
  107. class&#160;</td><td class="memItemRight" valign="bottom"><b>tbb::internal::task_scheduler_observer_v3</b></td></tr>
  108. <tr class="separator:a6887d06dd0f104ab6c06fdddca4d2471"><td class="memSeparator" colspan="2">&#160;</td></tr>
  109. </table>
  110. <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
  111. <div class="textblock"><p>1-to-1 proxy representation class of scheduler's arena Constructors set up settings only, real construction is deferred till the first method invocation 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>
  112. </div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
  113. <a class="anchor" id="a6035737ce1a8db376d06880dae9d0c40"></a>
  114. <div class="memitem">
  115. <div class="memproto">
  116. <table class="mlabels">
  117. <tr>
  118. <td class="mlabels-left">
  119. <table class="memname">
  120. <tr>
  121. <td class="memname">tbb::interface7::task_arena::task_arena </td>
  122. <td>(</td>
  123. <td class="paramtype">int&#160;</td>
  124. <td class="paramname"><em>max_concurrency</em> = <code>automatic</code>, </td>
  125. </tr>
  126. <tr>
  127. <td class="paramkey"></td>
  128. <td></td>
  129. <td class="paramtype">unsigned&#160;</td>
  130. <td class="paramname"><em>reserved_for_masters</em> = <code>1</code>&#160;</td>
  131. </tr>
  132. <tr>
  133. <td></td>
  134. <td>)</td>
  135. <td></td><td></td>
  136. </tr>
  137. </table>
  138. </td>
  139. <td class="mlabels-right">
  140. <span class="mlabels"><span class="mlabel">inline</span></span> </td>
  141. </tr>
  142. </table>
  143. </div><div class="memdoc">
  144. <p>Creates <a class="el" href="a00135.html">task_arena</a> with certain concurrency limits. </p>
  145. <p>Sets up settings only, real construction is deferred till the first method invocation </p>
  146. <ul>
  147. <li>max_concurrency specifies total number of slots in arena where threads work </li>
  148. <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>
  149. </ul>
  150. </div>
  151. </div>
  152. <a class="anchor" id="a9ff5a35a219953a4f3d99b833fa5f683"></a>
  153. <div class="memitem">
  154. <div class="memproto">
  155. <table class="mlabels">
  156. <tr>
  157. <td class="mlabels-left">
  158. <table class="memname">
  159. <tr>
  160. <td class="memname">tbb::interface7::task_arena::~task_arena </td>
  161. <td>(</td>
  162. <td class="paramname">)</td><td></td>
  163. <td></td>
  164. </tr>
  165. </table>
  166. </td>
  167. <td class="mlabels-right">
  168. <span class="mlabels"><span class="mlabel">inline</span></span> </td>
  169. </tr>
  170. </table>
  171. </div><div class="memdoc">
  172. <p>Removes the reference to the internal arena representation, and destroys the external object. Not thread safe wrt concurrent invocations of other methods. </p>
  173. </div>
  174. </div>
  175. <h2 class="groupheader">Member Function Documentation</h2>
  176. <a class="anchor" id="a07d87dff8c6116ee349684e10f754aeb"></a>
  177. <div class="memitem">
  178. <div class="memproto">
  179. <table class="mlabels">
  180. <tr>
  181. <td class="mlabels-left">
  182. <table class="memname">
  183. <tr>
  184. <td class="memname">void tbb::interface7::task_arena::debug_wait_until_empty </td>
  185. <td>(</td>
  186. <td class="paramname">)</td><td></td>
  187. <td></td>
  188. </tr>
  189. </table>
  190. </td>
  191. <td class="mlabels-right">
  192. <span class="mlabels"><span class="mlabel">inline</span></span> </td>
  193. </tr>
  194. </table>
  195. </div><div class="memdoc">
  196. <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="a00135.html#af0c96f325b59d567b4c720f2830adde8">execute()</a>) </p>
  197. </div>
  198. </div>
  199. <a class="anchor" id="a8034275ed2fffa68f70484043b90d406"></a>
  200. <div class="memitem">
  201. <div class="memproto">
  202. <div class="memtemplate">
  203. template&lt;typename F &gt; </div>
  204. <table class="mlabels">
  205. <tr>
  206. <td class="mlabels-left">
  207. <table class="memname">
  208. <tr>
  209. <td class="memname">void tbb::interface7::task_arena::enqueue </td>
  210. <td>(</td>
  211. <td class="paramtype">const F &amp;&#160;</td>
  212. <td class="paramname"><em>f</em>)</td><td></td>
  213. <td></td>
  214. </tr>
  215. </table>
  216. </td>
  217. <td class="mlabels-right">
  218. <span class="mlabels"><span class="mlabel">inline</span></span> </td>
  219. </tr>
  220. </table>
  221. </div><div class="memdoc">
  222. <p>Enqueues a task into the arena to process a functor, and immediately returns. Does not require the calling thread to join the arena </p>
  223. </div>
  224. </div>
  225. <a class="anchor" id="a9a04ab4afb2d74b0317618f59ab49be7"></a>
  226. <div class="memitem">
  227. <div class="memproto">
  228. <div class="memtemplate">
  229. template&lt;typename F &gt; </div>
  230. <table class="mlabels">
  231. <tr>
  232. <td class="mlabels-left">
  233. <table class="memname">
  234. <tr>
  235. <td class="memname">void tbb::interface7::task_arena::enqueue </td>
  236. <td>(</td>
  237. <td class="paramtype">const F &amp;&#160;</td>
  238. <td class="paramname"><em>f</em>, </td>
  239. </tr>
  240. <tr>
  241. <td class="paramkey"></td>
  242. <td></td>
  243. <td class="paramtype">priority_t&#160;</td>
  244. <td class="paramname"><em>p</em>&#160;</td>
  245. </tr>
  246. <tr>
  247. <td></td>
  248. <td>)</td>
  249. <td></td><td></td>
  250. </tr>
  251. </table>
  252. </td>
  253. <td class="mlabels-right">
  254. <span class="mlabels"><span class="mlabel">inline</span></span> </td>
  255. </tr>
  256. </table>
  257. </div><div class="memdoc">
  258. <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 </p>
  259. </div>
  260. </div>
  261. <a class="anchor" id="af0c96f325b59d567b4c720f2830adde8"></a>
  262. <div class="memitem">
  263. <div class="memproto">
  264. <div class="memtemplate">
  265. template&lt;typename F &gt; </div>
  266. <table class="mlabels">
  267. <tr>
  268. <td class="mlabels-left">
  269. <table class="memname">
  270. <tr>
  271. <td class="memname">void tbb::interface7::task_arena::execute </td>
  272. <td>(</td>
  273. <td class="paramtype">F &amp;&#160;</td>
  274. <td class="paramname"><em>f</em>)</td><td></td>
  275. <td></td>
  276. </tr>
  277. </table>
  278. </td>
  279. <td class="mlabels-right">
  280. <span class="mlabels"><span class="mlabel">inline</span></span> </td>
  281. </tr>
  282. </table>
  283. </div><div class="memdoc">
  284. <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 </p>
  285. </div>
  286. </div>
  287. <a class="anchor" id="ab8442c8e9e3e678349409e08cabc7ae2"></a>
  288. <div class="memitem">
  289. <div class="memproto">
  290. <div class="memtemplate">
  291. template&lt;typename F &gt; </div>
  292. <table class="mlabels">
  293. <tr>
  294. <td class="mlabels-left">
  295. <table class="memname">
  296. <tr>
  297. <td class="memname">void tbb::interface7::task_arena::execute </td>
  298. <td>(</td>
  299. <td class="paramtype">const F &amp;&#160;</td>
  300. <td class="paramname"><em>f</em>)</td><td></td>
  301. <td></td>
  302. </tr>
  303. </table>
  304. </td>
  305. <td class="mlabels-right">
  306. <span class="mlabels"><span class="mlabel">inline</span></span> </td>
  307. </tr>
  308. </table>
  309. </div><div class="memdoc">
  310. <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 </p>
  311. </div>
  312. </div>
  313. <a class="anchor" id="ad85856cefa30d42155a2b122b03efd8c"></a>
  314. <div class="memitem">
  315. <div class="memproto">
  316. <table class="mlabels">
  317. <tr>
  318. <td class="mlabels-left">
  319. <table class="memname">
  320. <tr>
  321. <td class="memname">bool tbb::interface7::task_arena::is_active </td>
  322. <td>(</td>
  323. <td class="paramname">)</td><td></td>
  324. <td> const</td>
  325. </tr>
  326. </table>
  327. </td>
  328. <td class="mlabels-right">
  329. <span class="mlabels"><span class="mlabel">inline</span></span> </td>
  330. </tr>
  331. </table>
  332. </div><div class="memdoc">
  333. <p>Returns true if the arena is active (initialized); false otherwise. The name was chosen to match a <a class="el" href="a00141.html" title="Class delimiting the scope of task scheduler activity. ">task_scheduler_init</a> method with the same semantics. </p>
  334. </div>
  335. </div>
  336. <a class="anchor" id="aecb3eedeacfe8469a91c17525dae7fc9"></a>
  337. <div class="memitem">
  338. <div class="memproto">
  339. <table class="mlabels">
  340. <tr>
  341. <td class="mlabels-left">
  342. <table class="memname">
  343. <tr>
  344. <td class="memname">void tbb::interface7::task_arena::terminate </td>
  345. <td>(</td>
  346. <td class="paramname">)</td><td></td>
  347. <td></td>
  348. </tr>
  349. </table>
  350. </td>
  351. <td class="mlabels-right">
  352. <span class="mlabels"><span class="mlabel">inline</span></span> </td>
  353. </tr>
  354. </table>
  355. </div><div class="memdoc">
  356. <p>Removes the reference to the internal arena representation. Not thread safe wrt concurrent invocations of other methods. </p>
  357. </div>
  358. </div>
  359. <hr/>The documentation for this class was generated from the following file:<ul>
  360. <li>task_arena.h</li>
  361. </ul>
  362. </div><!-- contents -->
  363. <hr>
  364. <p></p>
  365. Copyright &copy; 2005-2014 Intel Corporation. All Rights Reserved.
  366. <p></p>
  367. Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are
  368. registered trademarks or trademarks of Intel Corporation or its
  369. subsidiaries in the United States and other countries.
  370. <p></p>
  371. * Other names and brands may be claimed as the property of others.