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.
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.4"/> <title>tbb::interface5::reader_writer_lock Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <!-- end header part --> <!-- Generated by Doxygen 1.8.4 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="a00222.html">tbb</a></li><li class="navelem"><b>interface5</b></li><li class="navelem"><a class="el" href="a00095.html">reader_writer_lock</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#nested-classes">Classes</a> | <a href="#pub-types">Public Types</a> | <a href="#pub-methods">Public Member Functions</a> | <a href="#friends">Friends</a> | <a href="a00347.html">List of all members</a> </div> <div class="headertitle"> <div class="title">tbb::interface5::reader_writer_lock Class Reference<div class="ingroups"><a class="el" href="a00237.html">Synchronization</a></div></div> </div> </div><!--header--> <div class="contents">
<p>Writer-preference reader-writer lock with local-only spinning on readers. <a href="a00095.html#details">More...</a></p>
<p><code>#include <reader_writer_lock.h></code></p> <div class="dynheader"> Inheritance diagram for tbb::interface5::reader_writer_lock:</div> <div class="dyncontent"> <div class="center"> <img src="a00095.png" usemap="#tbb::interface5::reader_writer_lock_map" alt=""/> <map id="tbb::interface5::reader_writer_lock_map" name="tbb::interface5::reader_writer_lock_map"> </map> </div></div> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a> Classes</h2></td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="a00118.html">scoped_lock</a></td></tr> <tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">The scoped lock pattern for write locks. <a href="a00118.html#details">More...</a><br/></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="a00123.html">scoped_lock_read</a></td></tr> <tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">The scoped lock pattern for read locks. <a href="a00123.html#details">More...</a><br/></td></tr> <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a> Public Types</h2></td></tr> <tr class="memitem:a29bbf9ca21c12b313d9fa5326feaf3ed"><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="a00095.html#a29bbf9ca21c12b313d9fa5326feaf3ed">status_t</a> { <b>waiting_nonblocking</b>, <b>waiting</b>, <b>active</b>, <b>invalid</b> }</td></tr> <tr class="memdesc:a29bbf9ca21c12b313d9fa5326feaf3ed"><td class="mdescLeft"> </td><td class="mdescRight">Status type for nodes associated with lock instances. <a href="a00095.html#a29bbf9ca21c12b313d9fa5326feaf3ed">More...</a><br/></td></tr> <tr class="separator:a29bbf9ca21c12b313d9fa5326feaf3ed"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a> Public Member Functions</h2></td></tr> <tr class="memitem:abceda6c50b0c36eacbef51f4682742f3"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="abceda6c50b0c36eacbef51f4682742f3"></a>  </td><td class="memItemRight" valign="bottom"><a class="el" href="a00095.html#abceda6c50b0c36eacbef51f4682742f3">reader_writer_lock</a> ()</td></tr> <tr class="memdesc:abceda6c50b0c36eacbef51f4682742f3"><td class="mdescLeft"> </td><td class="mdescRight">Constructs a new <a class="el" href="a00095.html" title="Writer-preference reader-writer lock with local-only spinning on readers. ">reader_writer_lock</a>. <br/></td></tr> <tr class="separator:abceda6c50b0c36eacbef51f4682742f3"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:aeee96b648c7b5ff6126c8a2e13ec7241"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aeee96b648c7b5ff6126c8a2e13ec7241"></a>  </td><td class="memItemRight" valign="bottom"><a class="el" href="a00095.html#aeee96b648c7b5ff6126c8a2e13ec7241">~reader_writer_lock</a> ()</td></tr> <tr class="memdesc:aeee96b648c7b5ff6126c8a2e13ec7241"><td class="mdescLeft"> </td><td class="mdescRight">Destructs a <a class="el" href="a00095.html" title="Writer-preference reader-writer lock with local-only spinning on readers. ">reader_writer_lock</a> object. <br/></td></tr> <tr class="separator:aeee96b648c7b5ff6126c8a2e13ec7241"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:af92eb949fc491af8f7e350869ea0a0d1"><td class="memItemLeft" align="right" valign="top">void __TBB_EXPORTED_METHOD </td><td class="memItemRight" valign="bottom"><a class="el" href="a00095.html#af92eb949fc491af8f7e350869ea0a0d1">lock</a> ()</td></tr> <tr class="memdesc:af92eb949fc491af8f7e350869ea0a0d1"><td class="mdescLeft"> </td><td class="mdescRight">Acquires the <a class="el" href="a00095.html" title="Writer-preference reader-writer lock with local-only spinning on readers. ">reader_writer_lock</a> for write. <a href="#af92eb949fc491af8f7e350869ea0a0d1">More...</a><br/></td></tr> <tr class="separator:af92eb949fc491af8f7e350869ea0a0d1"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a1739e842af52925a2d4a7e821b9b3b8d"><td class="memItemLeft" align="right" valign="top">bool __TBB_EXPORTED_METHOD </td><td class="memItemRight" valign="bottom"><a class="el" href="a00095.html#a1739e842af52925a2d4a7e821b9b3b8d">try_lock</a> ()</td></tr> <tr class="memdesc:a1739e842af52925a2d4a7e821b9b3b8d"><td class="mdescLeft"> </td><td class="mdescRight">Tries to acquire the <a class="el" href="a00095.html" title="Writer-preference reader-writer lock with local-only spinning on readers. ">reader_writer_lock</a> for write. <a href="#a1739e842af52925a2d4a7e821b9b3b8d">More...</a><br/></td></tr> <tr class="separator:a1739e842af52925a2d4a7e821b9b3b8d"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a6fd4fcdf0e5c0425d1cc736d644f234f"><td class="memItemLeft" align="right" valign="top">void __TBB_EXPORTED_METHOD </td><td class="memItemRight" valign="bottom"><a class="el" href="a00095.html#a6fd4fcdf0e5c0425d1cc736d644f234f">lock_read</a> ()</td></tr> <tr class="memdesc:a6fd4fcdf0e5c0425d1cc736d644f234f"><td class="mdescLeft"> </td><td class="mdescRight">Acquires the <a class="el" href="a00095.html" title="Writer-preference reader-writer lock with local-only spinning on readers. ">reader_writer_lock</a> for read. <a href="#a6fd4fcdf0e5c0425d1cc736d644f234f">More...</a><br/></td></tr> <tr class="separator:a6fd4fcdf0e5c0425d1cc736d644f234f"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a9c7aa04e00202c9a1197cb6d870cabb4"><td class="memItemLeft" align="right" valign="top">bool __TBB_EXPORTED_METHOD </td><td class="memItemRight" valign="bottom"><a class="el" href="a00095.html#a9c7aa04e00202c9a1197cb6d870cabb4">try_lock_read</a> ()</td></tr> <tr class="memdesc:a9c7aa04e00202c9a1197cb6d870cabb4"><td class="mdescLeft"> </td><td class="mdescRight">Tries to acquire the <a class="el" href="a00095.html" title="Writer-preference reader-writer lock with local-only spinning on readers. ">reader_writer_lock</a> for read. <a href="#a9c7aa04e00202c9a1197cb6d870cabb4">More...</a><br/></td></tr> <tr class="separator:a9c7aa04e00202c9a1197cb6d870cabb4"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a4c55c4dbde63e950fdc843c9b01a174f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4c55c4dbde63e950fdc843c9b01a174f"></a> void __TBB_EXPORTED_METHOD </td><td class="memItemRight" valign="bottom"><a class="el" href="a00095.html#a4c55c4dbde63e950fdc843c9b01a174f">unlock</a> ()</td></tr> <tr class="memdesc:a4c55c4dbde63e950fdc843c9b01a174f"><td class="mdescLeft"> </td><td class="mdescRight">Releases the <a class="el" href="a00095.html" title="Writer-preference reader-writer lock with local-only spinning on readers. ">reader_writer_lock</a>. <br/></td></tr> <tr class="separator:a4c55c4dbde63e950fdc843c9b01a174f"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="friends"></a> Friends</h2></td></tr> <tr class="memitem:afcf922650b2fd9d76b7b939d8511bbd8"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afcf922650b2fd9d76b7b939d8511bbd8"></a> class </td><td class="memItemRight" valign="bottom"><b>scoped_lock</b></td></tr> <tr class="separator:afcf922650b2fd9d76b7b939d8511bbd8"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a578ccbc6ecbc6d32cb45ccfdc0ed4ee6"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a578ccbc6ecbc6d32cb45ccfdc0ed4ee6"></a> class </td><td class="memItemRight" valign="bottom"><b>scoped_lock_read</b></td></tr> <tr class="separator:a578ccbc6ecbc6d32cb45ccfdc0ed4ee6"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><p>Writer-preference reader-writer lock with local-only spinning on readers. </p> <p>Loosely adapted from Mellor-Crummey and Scott pseudocode at <a href="http://www.cs.rochester.edu/research/synchronization/pseudocode/rw.html#s_wp">http://www.cs.rochester.edu/research/synchronization/pseudocode/rw.html#s_wp</a> </p> </div><h2 class="groupheader">Member Enumeration Documentation</h2> <a class="anchor" id="a29bbf9ca21c12b313d9fa5326feaf3ed"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">enum <a class="el" href="a00095.html#a29bbf9ca21c12b313d9fa5326feaf3ed">tbb::interface5::reader_writer_lock::status_t</a></td> </tr> </table> </div><div class="memdoc">
<p>Status type for nodes associated with lock instances. </p> <p>waiting_nonblocking: the wait state for nonblocking lock instances; for writes, these transition straight to active states; for reads, these are unused.</p> <p>waiting: the start and spin state for all lock instances; these will transition to active state when appropriate. Non-blocking write locks transition from this state to waiting_nonblocking immediately.</p> <p>active: the active state means that the lock instance holds the lock; it will transition to invalid state during node deletion</p> <p>invalid: the end state for all nodes; this is set in the destructor so if we encounter this state, we are looking at memory that has already been freed</p> <p>The state diagrams below describe the status transitions. Single arrows indicate that the thread that owns the node is responsible for the transition; double arrows indicate that any thread could make the transition.</p> <p>State diagram for <a class="el" href="a00118.html" title="The scoped lock pattern for write locks. ">scoped_lock</a> status:</p> <p>waiting -------—> waiting_nonblocking | _____________/ | V V V active --------------—> invalid</p> <p>State diagram for <a class="el" href="a00123.html" title="The scoped lock pattern for read locks. ">scoped_lock_read</a> status:</p> <p>waiting | V active --------------—>invalid </p>
</div> </div> <h2 class="groupheader">Member Function Documentation</h2> <a class="anchor" id="af92eb949fc491af8f7e350869ea0a0d1"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void __TBB_EXPORTED_METHOD tbb::interface5::reader_writer_lock::lock </td> <td>(</td> <td class="paramname">)</td><td></td> <td></td> </tr> </table> </div><div class="memdoc">
<p>Acquires the <a class="el" href="a00095.html" title="Writer-preference reader-writer lock with local-only spinning on readers. ">reader_writer_lock</a> for write. </p> <p>If the lock is currently held in write mode by another context, the writer will block by spinning on a local variable. Exceptions thrown: <a class="el" href="a00065.html" title="Exception for PPL locks. ">improper_lock</a> The context tries to acquire a <a class="el" href="a00095.html" title="Writer-preference reader-writer lock with local-only spinning on readers. ">reader_writer_lock</a> that it already has write ownership of. </p>
</div> </div> <a class="anchor" id="a6fd4fcdf0e5c0425d1cc736d644f234f"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void __TBB_EXPORTED_METHOD tbb::interface5::reader_writer_lock::lock_read </td> <td>(</td> <td class="paramname">)</td><td></td> <td></td> </tr> </table> </div><div class="memdoc">
<p>Acquires the <a class="el" href="a00095.html" title="Writer-preference reader-writer lock with local-only spinning on readers. ">reader_writer_lock</a> for read. </p> <p>If the lock is currently held by a writer, this reader will block and wait until the writers are done. Exceptions thrown: <a class="el" href="a00065.html" title="Exception for PPL locks. ">improper_lock</a> The context tries to acquire a <a class="el" href="a00095.html" title="Writer-preference reader-writer lock with local-only spinning on readers. ">reader_writer_lock</a> that it already has write ownership of. </p>
</div> </div> <a class="anchor" id="a1739e842af52925a2d4a7e821b9b3b8d"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool __TBB_EXPORTED_METHOD tbb::interface5::reader_writer_lock::try_lock </td> <td>(</td> <td class="paramname">)</td><td></td> <td></td> </tr> </table> </div><div class="memdoc">
<p>Tries to acquire the <a class="el" href="a00095.html" title="Writer-preference reader-writer lock with local-only spinning on readers. ">reader_writer_lock</a> for write. </p> <p>This function does not block. Return Value: True or false, depending on whether the lock is acquired or not. If the lock is already held by this acquiring context, <a class="el" href="a00095.html#a1739e842af52925a2d4a7e821b9b3b8d" title="Tries to acquire the reader_writer_lock for write. ">try_lock()</a> returns false. </p>
</div> </div> <a class="anchor" id="a9c7aa04e00202c9a1197cb6d870cabb4"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool __TBB_EXPORTED_METHOD tbb::interface5::reader_writer_lock::try_lock_read </td> <td>(</td> <td class="paramname">)</td><td></td> <td></td> </tr> </table> </div><div class="memdoc">
<p>Tries to acquire the <a class="el" href="a00095.html" title="Writer-preference reader-writer lock with local-only spinning on readers. ">reader_writer_lock</a> for read. </p> <p>This function does not block. Return Value: True or false, depending on whether the lock is acquired or not. </p>
</div> </div> <hr/>The documentation for this class was generated from the following file:<ul> <li>reader_writer_lock.h</li> </ul> </div><!-- contents --> <hr> <p></p> Copyright © 2005-2014 Intel Corporation. All Rights Reserved. <p></p> Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries. <p></p> * Other names and brands may be claimed as the property of others.
|