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.

149 lines
9.6 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::spin_rw_mutex_v3::scoped_lock 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>::<a class="el" href="a00345.html">spin_rw_mutex_v3</a>::<a class="el" href="a00346.html">scoped_lock</a></div>
  25. <h1>tbb::spin_rw_mutex_v3::scoped_lock Class Reference</h1><!-- doxytag: class="tbb::spin_rw_mutex_v3::scoped_lock" -->The scoped locking pattern.
  26. <a href="#_details">More...</a>
  27. <p>
  28. <code>#include &lt;spin_rw_mutex.h&gt;</code>
  29. <p>
  30. <a href="a00130.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
  31. <tr><td></td></tr>
  32. <tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
  33. <tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00346.html#d6ea60dee5563f702379bf5e51aa8806">scoped_lock</a> ()</td></tr>
  34. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Construct lock that has not acquired a mutex. <a href="#d6ea60dee5563f702379bf5e51aa8806"></a><br></td></tr>
  35. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="42a92d4f8fdde425b111cfa8a9228071"></a><!-- doxytag: member="tbb::spin_rw_mutex_v3::scoped_lock::scoped_lock" ref="42a92d4f8fdde425b111cfa8a9228071" args="(spin_rw_mutex &amp;m, bool write=true)" -->
  36. &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00346.html#42a92d4f8fdde425b111cfa8a9228071">scoped_lock</a> (<a class="el" href="a00345.html">spin_rw_mutex</a> &amp;m, bool write=true)</td></tr>
  37. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Acquire lock on given mutex. <br></td></tr>
  38. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="d7eaaa3f2e2c5dc11e7005811b1bdd04"></a><!-- doxytag: member="tbb::spin_rw_mutex_v3::scoped_lock::~scoped_lock" ref="d7eaaa3f2e2c5dc11e7005811b1bdd04" args="()" -->
  39. &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00346.html#d7eaaa3f2e2c5dc11e7005811b1bdd04">~scoped_lock</a> ()</td></tr>
  40. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Release lock (if lock is held). <br></td></tr>
  41. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="b0b646ec5be02a127d159bbb7ca65353"></a><!-- doxytag: member="tbb::spin_rw_mutex_v3::scoped_lock::acquire" ref="b0b646ec5be02a127d159bbb7ca65353" args="(spin_rw_mutex &amp;m, bool write=true)" -->
  42. void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00346.html#b0b646ec5be02a127d159bbb7ca65353">acquire</a> (<a class="el" href="a00345.html">spin_rw_mutex</a> &amp;m, bool write=true)</td></tr>
  43. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Acquire lock on given mutex. <br></td></tr>
  44. <tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00346.html#3f0b1e3f2efab63336400348bd070226">upgrade_to_writer</a> ()</td></tr>
  45. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Upgrade reader to become a writer. <a href="#3f0b1e3f2efab63336400348bd070226"></a><br></td></tr>
  46. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="61b14d00a78185c9b2d206ebfc379124"></a><!-- doxytag: member="tbb::spin_rw_mutex_v3::scoped_lock::release" ref="61b14d00a78185c9b2d206ebfc379124" args="()" -->
  47. void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00346.html#61b14d00a78185c9b2d206ebfc379124">release</a> ()</td></tr>
  48. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Release lock. <br></td></tr>
  49. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="c2c2c38a08cb9080e87099fac3e5bc94"></a><!-- doxytag: member="tbb::spin_rw_mutex_v3::scoped_lock::downgrade_to_reader" ref="c2c2c38a08cb9080e87099fac3e5bc94" args="()" -->
  50. bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00346.html#c2c2c38a08cb9080e87099fac3e5bc94">downgrade_to_reader</a> ()</td></tr>
  51. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Downgrade writer to become a reader. <br></td></tr>
  52. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="9879626968d9b9a04cd2ec0fb2e84ae1"></a><!-- doxytag: member="tbb::spin_rw_mutex_v3::scoped_lock::try_acquire" ref="9879626968d9b9a04cd2ec0fb2e84ae1" args="(spin_rw_mutex &amp;m, bool write=true)" -->
  53. bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00346.html#9879626968d9b9a04cd2ec0fb2e84ae1">try_acquire</a> (<a class="el" href="a00345.html">spin_rw_mutex</a> &amp;m, bool write=true)</td></tr>
  54. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Try acquire lock on given mutex. <br></td></tr>
  55. <tr><td colspan="2"><br><h2>Protected Attributes</h2></td></tr>
  56. <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="d96d1a1fcc3d79ef3e5c06a53b8ffeaa"></a><!-- doxytag: member="tbb::spin_rw_mutex_v3::scoped_lock::mutex" ref="d96d1a1fcc3d79ef3e5c06a53b8ffeaa" args="" -->
  57. <a class="el" href="a00345.html">spin_rw_mutex</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00346.html#d96d1a1fcc3d79ef3e5c06a53b8ffeaa">mutex</a></td></tr>
  58. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The pointer to the current mutex that is held, or NULL if no mutex is held. <br></td></tr>
  59. <tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00346.html#6b5a7c3c67a36b05c4df8410d32627d8">is_writer</a></td></tr>
  60. <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">If mutex!=NULL, then is_writer is true if holding a writer lock, false if holding a reader lock. <a href="#6b5a7c3c67a36b05c4df8410d32627d8"></a><br></td></tr>
  61. </table>
  62. <hr><a name="_details"></a><h2>Detailed Description</h2>
  63. The scoped locking pattern.
  64. <p>
  65. It helps to avoid the common problem of forgetting to release lock. It also nicely provides the "node" for queuing locks.
  66. <p>
  67. <hr><h2>Constructor &amp; Destructor Documentation</h2>
  68. <a class="anchor" name="d6ea60dee5563f702379bf5e51aa8806"></a><!-- doxytag: member="tbb::spin_rw_mutex_v3::scoped_lock::scoped_lock" ref="d6ea60dee5563f702379bf5e51aa8806" args="()" -->
  69. <div class="memitem">
  70. <div class="memproto">
  71. <table class="memname">
  72. <tr>
  73. <td class="memname">tbb::spin_rw_mutex_v3::scoped_lock::scoped_lock </td>
  74. <td>(</td>
  75. <td class="paramname"> </td>
  76. <td>&nbsp;)&nbsp;</td>
  77. <td width="100%"><code> [inline]</code></td>
  78. </tr>
  79. </table>
  80. </div>
  81. <div class="memdoc">
  82. <p>
  83. Construct lock that has not acquired a mutex.
  84. <p>
  85. Equivalent to zero-initialization of *this.
  86. </div>
  87. </div><p>
  88. <hr><h2>Member Function Documentation</h2>
  89. <a class="anchor" name="3f0b1e3f2efab63336400348bd070226"></a><!-- doxytag: member="tbb::spin_rw_mutex_v3::scoped_lock::upgrade_to_writer" ref="3f0b1e3f2efab63336400348bd070226" args="()" -->
  90. <div class="memitem">
  91. <div class="memproto">
  92. <table class="memname">
  93. <tr>
  94. <td class="memname">bool tbb::spin_rw_mutex_v3::scoped_lock::upgrade_to_writer </td>
  95. <td>(</td>
  96. <td class="paramname"> </td>
  97. <td>&nbsp;)&nbsp;</td>
  98. <td width="100%"><code> [inline]</code></td>
  99. </tr>
  100. </table>
  101. </div>
  102. <div class="memdoc">
  103. <p>
  104. Upgrade reader to become a writer.
  105. <p>
  106. Returns whether the upgrade happened without releasing and re-acquiring the lock
  107. </div>
  108. </div><p>
  109. <hr><h2>Member Data Documentation</h2>
  110. <a class="anchor" name="6b5a7c3c67a36b05c4df8410d32627d8"></a><!-- doxytag: member="tbb::spin_rw_mutex_v3::scoped_lock::is_writer" ref="6b5a7c3c67a36b05c4df8410d32627d8" args="" -->
  111. <div class="memitem">
  112. <div class="memproto">
  113. <table class="memname">
  114. <tr>
  115. <td class="memname">bool <a class="el" href="a00346.html#6b5a7c3c67a36b05c4df8410d32627d8">tbb::spin_rw_mutex_v3::scoped_lock::is_writer</a><code> [protected]</code> </td>
  116. </tr>
  117. </table>
  118. </div>
  119. <div class="memdoc">
  120. <p>
  121. If mutex!=NULL, then is_writer is true if holding a writer lock, false if holding a reader lock.
  122. <p>
  123. Not defined if not holding a lock.
  124. </div>
  125. </div><p>
  126. <hr>The documentation for this class was generated from the following file:<ul>
  127. <li>spin_rw_mutex.h</ul>
  128. <hr>
  129. <p></p>
  130. Copyright &copy; 2005-2013 Intel Corporation. All Rights Reserved.
  131. <p></p>
  132. Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are
  133. registered trademarks or trademarks of Intel Corporation or its
  134. subsidiaries in the United States and other countries.
  135. <p></p>
  136. * Other names and brands may be claimed as the property of others.