<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>GNU CommonC++: ost::ReadLock Class Reference</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.4.6 --> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li id="current"><a href="classes.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> </ul></div> <div class="tabs"> <ul> <li><a href="classes.html"><span>Alphabetical List</span></a></li> <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 class="nav"> <a class="el" href="namespaceost.html">ost</a>::<a class="el" href="classost_1_1_read_lock.html">ReadLock</a></div> <h1>ost::ReadLock Class Reference</h1><!-- doxytag: class="ost::ReadLock" -->The <a class="el" href="classost_1_1_read_lock.html">ReadLock</a> class is used to protect a section of code through a <a class="el" href="classost_1_1_thread_lock.html">ThreadLock</a> for "read" access to the member function.Read mode automatic locker for protected access. <a href="#_details">More...</a> <p> <code>#include <<a class="el" href="thread_8h-source.html">thread.h</a>></code> <p> <a href="classost_1_1_read_lock-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0"> <tr><td></td></tr> <tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_read_lock.html#05b7c96baf6695c580871d0aaf01c149">ReadLock</a> (<a class="el" href="classost_1_1_thread_lock.html">ThreadLock</a> &_tl)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Wait for read access. <a href="#05b7c96baf6695c580871d0aaf01c149"></a><br></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_read_lock.html#166b6a55b9fa7072be782b7eccf30a98">~ReadLock</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Post the semaphore automatically. <a href="#166b6a55b9fa7072be782b7eccf30a98"></a><br></td></tr> </table> <hr><a name="_details"></a><h2>Detailed Description</h2> The <a class="el" href="classost_1_1_read_lock.html">ReadLock</a> class is used to protect a section of code through a <a class="el" href="classost_1_1_thread_lock.html">ThreadLock</a> for "read" access to the member function.Read mode automatic locker for protected access. <p> The <a class="el" href="classost_1_1_thread_lock.html">ThreadLock</a> is automatically released when the object falls out of scope.<p> A common use is<p> void func_to_protect() { <a class="el" href="classost_1_1_read_lock.html">ReadLock</a> lock(threadlock); ... operation ... }<p> NOTE: do not declare variable as "ReadLock (threadlock)", the mutex will be released at statement end.<p> <dl compact><dt><b>Author:</b></dt><dd>David Sugar <<a href="mailto:dyfet@gnu.org">dyfet@gnu.org</a>> </dd></dl> <p> <hr><h2>Constructor & Destructor Documentation</h2> <a class="anchor" name="05b7c96baf6695c580871d0aaf01c149"></a><!-- doxytag: member="ost::ReadLock::ReadLock" ref="05b7c96baf6695c580871d0aaf01c149" args="(ThreadLock &_tl)" --><p> <table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">ost::ReadLock::ReadLock </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="classost_1_1_thread_lock.html">ThreadLock</a> & </td> <td class="mdname1" valign="top" nowrap> <em>_tl</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap><code> [inline]</code></td> </tr> </table> </td> </tr> </table> <table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td> <p> Wait for read access. <p> <dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>_tl</em> </td><td>reference to lock to aquire. </td></tr> </table> </dl> </td> </tr> </table> <a class="anchor" name="166b6a55b9fa7072be782b7eccf30a98"></a><!-- doxytag: member="ost::ReadLock::~ReadLock" ref="166b6a55b9fa7072be782b7eccf30a98" args="()" --><p> <table class="mdTable" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top">ost::ReadLock::~ReadLock </td> <td class="md" valign="top">( </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap><code> [inline]</code></td> </tr> </table> </td> </tr> </table> <table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td> <p> Post the semaphore automatically. <p> </td> </tr> </table> <hr>The documentation for this class was generated from the following file:<ul> <li><a class="el" href="thread_8h-source.html">thread.h</a></ul> <hr size="1"><address style="align: right;"><small>Generated on Mon Jun 19 10:50:57 2006 for GNU CommonC++ by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.6 </small></address> </body> </html>