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.

228 lines
15 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::spin_rw_mutex_v3 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"><a class="el" href="a00128.html">spin_rw_mutex_v3</a></li> </ul>
  37. </div>
  38. </div><!-- top -->
  39. <div class="header">
  40. <div class="summary">
  41. <a href="#nested-classes">Classes</a> &#124;
  42. <a href="#pub-methods">Public Member Functions</a> &#124;
  43. <a href="#pub-static-attribs">Static Public Attributes</a> &#124;
  44. <a href="#pro-types">Protected Types</a> &#124;
  45. <a href="#pro-attribs">Protected Attributes</a> &#124;
  46. <a href="#pro-static-attribs">Static Protected Attributes</a> &#124;
  47. <a href="a00283.html">List of all members</a> </div>
  48. <div class="headertitle">
  49. <div class="title">tbb::spin_rw_mutex_v3 Class Reference<div class="ingroups"><a class="el" href="a00237.html">Synchronization</a></div></div> </div>
  50. </div><!--header-->
  51. <div class="contents">
  52. <p>Fast, unfair, spinning reader-writer lock with backoff and writer-preference.
  53. <a href="a00128.html#details">More...</a></p>
  54. <p><code>#include &lt;spin_rw_mutex.h&gt;</code></p>
  55. <table class="memberdecls">
  56. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
  57. Classes</h2></td></tr>
  58. <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00114.html">scoped_lock</a></td></tr>
  59. <tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">The scoped locking pattern. <a href="a00114.html#details">More...</a><br/></td></tr>
  60. <tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
  61. </table><table class="memberdecls">
  62. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
  63. Public Member Functions</h2></td></tr>
  64. <tr class="memitem:ad30fc1ffa0a2b8134e177e02c5821d7f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad30fc1ffa0a2b8134e177e02c5821d7f"></a>
  65. &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00128.html#ad30fc1ffa0a2b8134e177e02c5821d7f">spin_rw_mutex_v3</a> ()</td></tr>
  66. <tr class="memdesc:ad30fc1ffa0a2b8134e177e02c5821d7f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Construct unacquired mutex. <br/></td></tr>
  67. <tr class="separator:ad30fc1ffa0a2b8134e177e02c5821d7f"><td class="memSeparator" colspan="2">&#160;</td></tr>
  68. <tr class="memitem:acc7cf2e4b14d3a2a591a3552d74ba99d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="acc7cf2e4b14d3a2a591a3552d74ba99d"></a>
  69. &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00128.html#acc7cf2e4b14d3a2a591a3552d74ba99d">~spin_rw_mutex_v3</a> ()</td></tr>
  70. <tr class="memdesc:acc7cf2e4b14d3a2a591a3552d74ba99d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor asserts if the mutex is acquired, i.e. state is zero. <br/></td></tr>
  71. <tr class="separator:acc7cf2e4b14d3a2a591a3552d74ba99d"><td class="memSeparator" colspan="2">&#160;</td></tr>
  72. <tr class="memitem:a51e207646300a4c242bb4aaa4e04e9b8"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a51e207646300a4c242bb4aaa4e04e9b8"></a>
  73. void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00128.html#a51e207646300a4c242bb4aaa4e04e9b8">lock</a> ()</td></tr>
  74. <tr class="memdesc:a51e207646300a4c242bb4aaa4e04e9b8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Acquire writer lock. <br/></td></tr>
  75. <tr class="separator:a51e207646300a4c242bb4aaa4e04e9b8"><td class="memSeparator" colspan="2">&#160;</td></tr>
  76. <tr class="memitem:ab6ec20b1ec43a49c8c2908984e35b5e8"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00128.html#ab6ec20b1ec43a49c8c2908984e35b5e8">try_lock</a> ()</td></tr>
  77. <tr class="memdesc:ab6ec20b1ec43a49c8c2908984e35b5e8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Try acquiring writer lock (non-blocking) <a href="#ab6ec20b1ec43a49c8c2908984e35b5e8">More...</a><br/></td></tr>
  78. <tr class="separator:ab6ec20b1ec43a49c8c2908984e35b5e8"><td class="memSeparator" colspan="2">&#160;</td></tr>
  79. <tr class="memitem:ab04321ed2cdf12ac5825c54591028fc0"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab04321ed2cdf12ac5825c54591028fc0"></a>
  80. void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00128.html#ab04321ed2cdf12ac5825c54591028fc0">unlock</a> ()</td></tr>
  81. <tr class="memdesc:ab04321ed2cdf12ac5825c54591028fc0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Release lock. <br/></td></tr>
  82. <tr class="separator:ab04321ed2cdf12ac5825c54591028fc0"><td class="memSeparator" colspan="2">&#160;</td></tr>
  83. <tr class="memitem:aa0e3bb644e9021d0f80ee36b03f228e4"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa0e3bb644e9021d0f80ee36b03f228e4"></a>
  84. void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00128.html#aa0e3bb644e9021d0f80ee36b03f228e4">lock_read</a> ()</td></tr>
  85. <tr class="memdesc:aa0e3bb644e9021d0f80ee36b03f228e4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Acquire reader lock. <br/></td></tr>
  86. <tr class="separator:aa0e3bb644e9021d0f80ee36b03f228e4"><td class="memSeparator" colspan="2">&#160;</td></tr>
  87. <tr class="memitem:ac932f65b0b66320688e7957ce9c3e2c1"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00128.html#ac932f65b0b66320688e7957ce9c3e2c1">try_lock_read</a> ()</td></tr>
  88. <tr class="memdesc:ac932f65b0b66320688e7957ce9c3e2c1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Try acquiring reader lock (non-blocking) <a href="#ac932f65b0b66320688e7957ce9c3e2c1">More...</a><br/></td></tr>
  89. <tr class="separator:ac932f65b0b66320688e7957ce9c3e2c1"><td class="memSeparator" colspan="2">&#160;</td></tr>
  90. </table><table class="memberdecls">
  91. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-attribs"></a>
  92. Static Public Attributes</h2></td></tr>
  93. <tr class="memitem:addc8223faacc1bb2cc8626b609ab2c49"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="addc8223faacc1bb2cc8626b609ab2c49"></a>
  94. static const bool&#160;</td><td class="memItemRight" valign="bottom"><b>is_rw_mutex</b> = true</td></tr>
  95. <tr class="separator:addc8223faacc1bb2cc8626b609ab2c49"><td class="memSeparator" colspan="2">&#160;</td></tr>
  96. <tr class="memitem:a7f6aa8fe3e9c7c4ee4cdec6d221ffe45"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7f6aa8fe3e9c7c4ee4cdec6d221ffe45"></a>
  97. static const bool&#160;</td><td class="memItemRight" valign="bottom"><b>is_recursive_mutex</b> = false</td></tr>
  98. <tr class="separator:a7f6aa8fe3e9c7c4ee4cdec6d221ffe45"><td class="memSeparator" colspan="2">&#160;</td></tr>
  99. <tr class="memitem:affd403f6e3822589e985a2c23505fbd1"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="affd403f6e3822589e985a2c23505fbd1"></a>
  100. static const bool&#160;</td><td class="memItemRight" valign="bottom"><b>is_fair_mutex</b> = false</td></tr>
  101. <tr class="separator:affd403f6e3822589e985a2c23505fbd1"><td class="memSeparator" colspan="2">&#160;</td></tr>
  102. </table><table class="memberdecls">
  103. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-types"></a>
  104. Protected Types</h2></td></tr>
  105. <tr class="memitem:a27adc7d791dfaa4a60638313b9d1c1f4"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a27adc7d791dfaa4a60638313b9d1c1f4"></a>
  106. typedef intptr_t&#160;</td><td class="memItemRight" valign="bottom"><b>state_t</b></td></tr>
  107. <tr class="separator:a27adc7d791dfaa4a60638313b9d1c1f4"><td class="memSeparator" colspan="2">&#160;</td></tr>
  108. </table><table class="memberdecls">
  109. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
  110. Protected Attributes</h2></td></tr>
  111. <tr class="memitem:aa28625051072472ccd8a2b19405d6fb3"><td class="memItemLeft" align="right" valign="top">state_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00128.html#aa28625051072472ccd8a2b19405d6fb3">state</a></td></tr>
  112. <tr class="memdesc:aa28625051072472ccd8a2b19405d6fb3"><td class="mdescLeft">&#160;</td><td class="mdescRight">State of lock. <a href="#aa28625051072472ccd8a2b19405d6fb3">More...</a><br/></td></tr>
  113. <tr class="separator:aa28625051072472ccd8a2b19405d6fb3"><td class="memSeparator" colspan="2">&#160;</td></tr>
  114. </table><table class="memberdecls">
  115. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-static-attribs"></a>
  116. Static Protected Attributes</h2></td></tr>
  117. <tr class="memitem:aaeec59dde09fe92be196ecddb480777b"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aaeec59dde09fe92be196ecddb480777b"></a>
  118. static const state_t&#160;</td><td class="memItemRight" valign="bottom"><b>WRITER</b> = 1</td></tr>
  119. <tr class="separator:aaeec59dde09fe92be196ecddb480777b"><td class="memSeparator" colspan="2">&#160;</td></tr>
  120. <tr class="memitem:a5b321914828e5e21baf24d58f32c66d5"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a5b321914828e5e21baf24d58f32c66d5"></a>
  121. static const state_t&#160;</td><td class="memItemRight" valign="bottom"><b>WRITER_PENDING</b> = 2</td></tr>
  122. <tr class="separator:a5b321914828e5e21baf24d58f32c66d5"><td class="memSeparator" colspan="2">&#160;</td></tr>
  123. <tr class="memitem:a6cc93cdcf4ad43f6bf8b0f76cde66f9e"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6cc93cdcf4ad43f6bf8b0f76cde66f9e"></a>
  124. static const state_t&#160;</td><td class="memItemRight" valign="bottom"><b>READERS</b> = ~(WRITER | WRITER_PENDING)</td></tr>
  125. <tr class="separator:a6cc93cdcf4ad43f6bf8b0f76cde66f9e"><td class="memSeparator" colspan="2">&#160;</td></tr>
  126. <tr class="memitem:af1386a2fa5979432e4a58b94e68db23f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af1386a2fa5979432e4a58b94e68db23f"></a>
  127. static const state_t&#160;</td><td class="memItemRight" valign="bottom"><b>ONE_READER</b> = 4</td></tr>
  128. <tr class="separator:af1386a2fa5979432e4a58b94e68db23f"><td class="memSeparator" colspan="2">&#160;</td></tr>
  129. <tr class="memitem:a6a811c72bd7e5ad6a3a9161ee05e298c"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6a811c72bd7e5ad6a3a9161ee05e298c"></a>
  130. static const state_t&#160;</td><td class="memItemRight" valign="bottom"><b>BUSY</b> = WRITER | READERS</td></tr>
  131. <tr class="separator:a6a811c72bd7e5ad6a3a9161ee05e298c"><td class="memSeparator" colspan="2">&#160;</td></tr>
  132. </table>
  133. <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
  134. <div class="textblock"><p>Fast, unfair, spinning reader-writer lock with backoff and writer-preference. </p>
  135. </div><h2 class="groupheader">Member Function Documentation</h2>
  136. <a class="anchor" id="ab6ec20b1ec43a49c8c2908984e35b5e8"></a>
  137. <div class="memitem">
  138. <div class="memproto">
  139. <table class="mlabels">
  140. <tr>
  141. <td class="mlabels-left">
  142. <table class="memname">
  143. <tr>
  144. <td class="memname">bool tbb::spin_rw_mutex_v3::try_lock </td>
  145. <td>(</td>
  146. <td class="paramname">)</td><td></td>
  147. <td></td>
  148. </tr>
  149. </table>
  150. </td>
  151. <td class="mlabels-right">
  152. <span class="mlabels"><span class="mlabel">inline</span></span> </td>
  153. </tr>
  154. </table>
  155. </div><div class="memdoc">
  156. <p>Try acquiring writer lock (non-blocking) </p>
  157. <p>Return true if lock acquired; false otherwise. </p>
  158. </div>
  159. </div>
  160. <a class="anchor" id="ac932f65b0b66320688e7957ce9c3e2c1"></a>
  161. <div class="memitem">
  162. <div class="memproto">
  163. <table class="mlabels">
  164. <tr>
  165. <td class="mlabels-left">
  166. <table class="memname">
  167. <tr>
  168. <td class="memname">bool tbb::spin_rw_mutex_v3::try_lock_read </td>
  169. <td>(</td>
  170. <td class="paramname">)</td><td></td>
  171. <td></td>
  172. </tr>
  173. </table>
  174. </td>
  175. <td class="mlabels-right">
  176. <span class="mlabels"><span class="mlabel">inline</span></span> </td>
  177. </tr>
  178. </table>
  179. </div><div class="memdoc">
  180. <p>Try acquiring reader lock (non-blocking) </p>
  181. <p>Return true if reader lock acquired; false otherwise. </p>
  182. </div>
  183. </div>
  184. <h2 class="groupheader">Member Data Documentation</h2>
  185. <a class="anchor" id="aa28625051072472ccd8a2b19405d6fb3"></a>
  186. <div class="memitem">
  187. <div class="memproto">
  188. <table class="mlabels">
  189. <tr>
  190. <td class="mlabels-left">
  191. <table class="memname">
  192. <tr>
  193. <td class="memname">state_t tbb::spin_rw_mutex_v3::state</td>
  194. </tr>
  195. </table>
  196. </td>
  197. <td class="mlabels-right">
  198. <span class="mlabels"><span class="mlabel">protected</span></span> </td>
  199. </tr>
  200. </table>
  201. </div><div class="memdoc">
  202. <p>State of lock. </p>
  203. <p>Bit 0 = writer is holding lock Bit 1 = request by a writer to acquire lock (hint to readers to wait) Bit 2..N = number of readers holding lock </p>
  204. <p>Referenced by <a class="el" href="a00114.html#a99e279a995a51abfb87b865e886949f8">tbb::spin_rw_mutex_v3::scoped_lock::release()</a>, and <a class="el" href="a00128.html#ab04321ed2cdf12ac5825c54591028fc0">unlock()</a>.</p>
  205. </div>
  206. </div>
  207. <hr/>The documentation for this class was generated from the following file:<ul>
  208. <li>spin_rw_mutex.h</li>
  209. </ul>
  210. </div><!-- contents -->
  211. <hr>
  212. <p></p>
  213. Copyright &copy; 2005-2014 Intel Corporation. All Rights Reserved.
  214. <p></p>
  215. Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are
  216. registered trademarks or trademarks of Intel Corporation or its
  217. subsidiaries in the United States and other countries.
  218. <p></p>
  219. * Other names and brands may be claimed as the property of others.