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.

155 lines
9.7 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::queuing_rw_mutex::scoped_lock 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="a00094.html">queuing_rw_mutex</a></li><li class="navelem"><a class="el" href="a00119.html">scoped_lock</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="a00274.html">List of all members</a> </div>
  43. <div class="headertitle">
  44. <div class="title">tbb::queuing_rw_mutex::scoped_lock Class Reference</div> </div>
  45. </div><!--header-->
  46. <div class="contents">
  47. <p>The scoped locking pattern.
  48. <a href="a00119.html#details">More...</a></p>
  49. <p><code>#include &lt;queuing_rw_mutex.h&gt;</code></p>
  50. <div class="dynheader">
  51. Inheritance diagram for tbb::queuing_rw_mutex::scoped_lock:</div>
  52. <div class="dyncontent">
  53. <div class="center">
  54. <img src="a00119.png" usemap="#tbb::queuing_rw_mutex::scoped_lock_map" alt=""/>
  55. <map id="tbb::queuing_rw_mutex::scoped_lock_map" name="tbb::queuing_rw_mutex::scoped_lock_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:a1ae3792726dcff8da1f2c5366fb2b754"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00119.html#a1ae3792726dcff8da1f2c5366fb2b754">scoped_lock</a> ()</td></tr>
  62. <tr class="memdesc:a1ae3792726dcff8da1f2c5366fb2b754"><td class="mdescLeft">&#160;</td><td class="mdescRight">Construct lock that has not acquired a mutex. <a href="#a1ae3792726dcff8da1f2c5366fb2b754">More...</a><br/></td></tr>
  63. <tr class="separator:a1ae3792726dcff8da1f2c5366fb2b754"><td class="memSeparator" colspan="2">&#160;</td></tr>
  64. <tr class="memitem:af1b55ca1839c9c7c2cd779cd2dd9c474"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af1b55ca1839c9c7c2cd779cd2dd9c474"></a>
  65. &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00119.html#af1b55ca1839c9c7c2cd779cd2dd9c474">scoped_lock</a> (<a class="el" href="a00094.html">queuing_rw_mutex</a> &amp;m, bool write=true)</td></tr>
  66. <tr class="memdesc:af1b55ca1839c9c7c2cd779cd2dd9c474"><td class="mdescLeft">&#160;</td><td class="mdescRight">Acquire lock on given mutex. <br/></td></tr>
  67. <tr class="separator:af1b55ca1839c9c7c2cd779cd2dd9c474"><td class="memSeparator" colspan="2">&#160;</td></tr>
  68. <tr class="memitem:a6cb16cc55f884bbbd5a69430c47b288f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6cb16cc55f884bbbd5a69430c47b288f"></a>
  69. &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00119.html#a6cb16cc55f884bbbd5a69430c47b288f">~scoped_lock</a> ()</td></tr>
  70. <tr class="memdesc:a6cb16cc55f884bbbd5a69430c47b288f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Release lock (if lock is held). <br/></td></tr>
  71. <tr class="separator:a6cb16cc55f884bbbd5a69430c47b288f"><td class="memSeparator" colspan="2">&#160;</td></tr>
  72. <tr class="memitem:ab4bf2fb86d6a418f9ea36474eb8893f9"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab4bf2fb86d6a418f9ea36474eb8893f9"></a>
  73. void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00119.html#ab4bf2fb86d6a418f9ea36474eb8893f9">acquire</a> (<a class="el" href="a00094.html">queuing_rw_mutex</a> &amp;m, bool write=true)</td></tr>
  74. <tr class="memdesc:ab4bf2fb86d6a418f9ea36474eb8893f9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Acquire lock on given mutex. <br/></td></tr>
  75. <tr class="separator:ab4bf2fb86d6a418f9ea36474eb8893f9"><td class="memSeparator" colspan="2">&#160;</td></tr>
  76. <tr class="memitem:a4843d40dddc37c1aa3444e27d35d2433"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4843d40dddc37c1aa3444e27d35d2433"></a>
  77. bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00119.html#a4843d40dddc37c1aa3444e27d35d2433">try_acquire</a> (<a class="el" href="a00094.html">queuing_rw_mutex</a> &amp;m, bool write=true)</td></tr>
  78. <tr class="memdesc:a4843d40dddc37c1aa3444e27d35d2433"><td class="mdescLeft">&#160;</td><td class="mdescRight">Acquire lock on given mutex if free (i.e. non-blocking) <br/></td></tr>
  79. <tr class="separator:a4843d40dddc37c1aa3444e27d35d2433"><td class="memSeparator" colspan="2">&#160;</td></tr>
  80. <tr class="memitem:a50fb02b77f02a01c74754d163157ec77"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a50fb02b77f02a01c74754d163157ec77"></a>
  81. void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00119.html#a50fb02b77f02a01c74754d163157ec77">release</a> ()</td></tr>
  82. <tr class="memdesc:a50fb02b77f02a01c74754d163157ec77"><td class="mdescLeft">&#160;</td><td class="mdescRight">Release lock. <br/></td></tr>
  83. <tr class="separator:a50fb02b77f02a01c74754d163157ec77"><td class="memSeparator" colspan="2">&#160;</td></tr>
  84. <tr class="memitem:ae0f28ecfbbc5f8b3024cd47048b72b5b"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00119.html#ae0f28ecfbbc5f8b3024cd47048b72b5b">upgrade_to_writer</a> ()</td></tr>
  85. <tr class="memdesc:ae0f28ecfbbc5f8b3024cd47048b72b5b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Upgrade reader to become a writer. <a href="#ae0f28ecfbbc5f8b3024cd47048b72b5b">More...</a><br/></td></tr>
  86. <tr class="separator:ae0f28ecfbbc5f8b3024cd47048b72b5b"><td class="memSeparator" colspan="2">&#160;</td></tr>
  87. <tr class="memitem:af0af63035147a3d8422f8c8d7b8d2629"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af0af63035147a3d8422f8c8d7b8d2629"></a>
  88. bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00119.html#af0af63035147a3d8422f8c8d7b8d2629">downgrade_to_reader</a> ()</td></tr>
  89. <tr class="memdesc:af0af63035147a3d8422f8c8d7b8d2629"><td class="mdescLeft">&#160;</td><td class="mdescRight">Downgrade writer to become a reader. <br/></td></tr>
  90. <tr class="separator:af0af63035147a3d8422f8c8d7b8d2629"><td class="memSeparator" colspan="2">&#160;</td></tr>
  91. </table>
  92. <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
  93. <div class="textblock"><p>The scoped locking pattern. </p>
  94. <p>It helps to avoid the common problem of forgetting to release lock. It also nicely provides the "node" for queuing locks. </p>
  95. </div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
  96. <a class="anchor" id="a1ae3792726dcff8da1f2c5366fb2b754"></a>
  97. <div class="memitem">
  98. <div class="memproto">
  99. <table class="mlabels">
  100. <tr>
  101. <td class="mlabels-left">
  102. <table class="memname">
  103. <tr>
  104. <td class="memname">tbb::queuing_rw_mutex::scoped_lock::scoped_lock </td>
  105. <td>(</td>
  106. <td class="paramname">)</td><td></td>
  107. <td></td>
  108. </tr>
  109. </table>
  110. </td>
  111. <td class="mlabels-right">
  112. <span class="mlabels"><span class="mlabel">inline</span></span> </td>
  113. </tr>
  114. </table>
  115. </div><div class="memdoc">
  116. <p>Construct lock that has not acquired a mutex. </p>
  117. <p>Equivalent to zero-initialization of *this. </p>
  118. </div>
  119. </div>
  120. <h2 class="groupheader">Member Function Documentation</h2>
  121. <a class="anchor" id="ae0f28ecfbbc5f8b3024cd47048b72b5b"></a>
  122. <div class="memitem">
  123. <div class="memproto">
  124. <table class="memname">
  125. <tr>
  126. <td class="memname">bool tbb::queuing_rw_mutex::scoped_lock::upgrade_to_writer </td>
  127. <td>(</td>
  128. <td class="paramname">)</td><td></td>
  129. <td></td>
  130. </tr>
  131. </table>
  132. </div><div class="memdoc">
  133. <p>Upgrade reader to become a writer. </p>
  134. <p>Returns whether the upgrade happened without releasing and re-acquiring the lock </p>
  135. </div>
  136. </div>
  137. <hr/>The documentation for this class was generated from the following file:<ul>
  138. <li>queuing_rw_mutex.h</li>
  139. </ul>
  140. </div><!-- contents -->
  141. <hr>
  142. <p></p>
  143. Copyright &copy; 2005-2014 Intel Corporation. All Rights Reserved.
  144. <p></p>
  145. Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are
  146. registered trademarks or trademarks of Intel Corporation or its
  147. subsidiaries in the United States and other countries.
  148. <p></p>
  149. * Other names and brands may be claimed as the property of others.