<!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"/> <title>GNU CommonC++: ost::SemaphoreLock Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.3 --> <div class="navigation" id="top"> <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 class="current"><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li><a href="examples.html"><span>Examples</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="classes.html"><span>Class Index</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="navpath"><a class="el" href="namespaceost.html">ost</a>::<a class="el" href="classost_1_1_semaphore_lock.html">SemaphoreLock</a> </div> </div> <div class="contents"> <h1>ost::SemaphoreLock Class Reference</h1><!-- doxytag: class="ost::SemaphoreLock" --> <p>The <a class="el" href="classost_1_1_semaphore_lock.html" title="The SemaphoreLock class is used to protect a section of code through a semaphore...">SemaphoreLock</a> class is used to protect a section of code through a semaphore so that only x instances of the member function may execute concurrently. <a href="#_details">More...</a></p> <p><code>#include <<a class="el" href="thread_8h_source.html">thread.h</a>></code></p> <p><a href="classost_1_1_semaphore_lock-members.html">List of all members.</a></p> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_semaphore_lock.html#adb34354071ac2005870fb78926887a05">SemaphoreLock</a> (<a class="el" href="classost_1_1_semaphore.html">Semaphore</a> &_sem)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Wait for the semaphore. <a href="#adb34354071ac2005870fb78926887a05"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_semaphore_lock.html#a59bf7e09b61fd3b900070841fae86597">~SemaphoreLock</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Post the semaphore automatically. <a href="#a59bf7e09b61fd3b900070841fae86597"></a><br/></td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>The <a class="el" href="classost_1_1_semaphore_lock.html" title="The SemaphoreLock class is used to protect a section of code through a semaphore...">SemaphoreLock</a> class is used to protect a section of code through a semaphore so that only x instances of the member function may execute concurrently. </p> <p>A common use is</p> <p>void func_to_protect() { <a class="el" href="classost_1_1_semaphore_lock.html" title="The SemaphoreLock class is used to protect a section of code through a semaphore...">SemaphoreLock</a> lock(semaphore); ... operation ... }</p> <p>NOTE: do not declare variable as "SemaohoreLock (semaphore)", the mutex will be released at statement end.</p> <dl class="author"><dt><b>Author:</b></dt><dd>David Sugar <<a href="mailto:dyfet@gnu.org">dyfet@gnu.org</a>> <a class="el" href="classost_1_1_semaphore.html" title="A semaphore is generally used as a synchronization object between multiple threads...">Semaphore</a> automatic locker for protected access. </dd></dl> <hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="adb34354071ac2005870fb78926887a05"></a><!-- doxytag: member="ost::SemaphoreLock::SemaphoreLock" ref="adb34354071ac2005870fb78926887a05" args="(Semaphore &_sem)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">ost::SemaphoreLock::SemaphoreLock </td> <td>(</td> <td class="paramtype"><a class="el" href="classost_1_1_semaphore.html">Semaphore</a> & </td> <td class="paramname"> <em>_sem</em></td> <td> ) </td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Wait for the semaphore. </p> </div> </div> <a class="anchor" id="a59bf7e09b61fd3b900070841fae86597"></a><!-- doxytag: member="ost::SemaphoreLock::~SemaphoreLock" ref="a59bf7e09b61fd3b900070841fae86597" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">ost::SemaphoreLock::~SemaphoreLock </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td><code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Post the semaphore automatically. </p> </div> </div> <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></li> </ul> </div> <hr class="footer"/><address style="text-align: right;"><small>Generated on Fri Nov 12 09:55:47 2010 for GNU CommonC++ by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address> </body> </html>