<!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.5"/> <title>GNU CommonC++: ost::SemaphoreLock 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! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">GNU CommonC++ </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.5 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <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 id="navrow2" class="tabs2"> <ul class="tablist"> <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 id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="namespaceost.html">ost</a></li><li class="navelem"><a class="el" href="classost_1_1_semaphore_lock.html">SemaphoreLock</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#pub-methods">Public Member Functions</a> | <a href="classost_1_1_semaphore_lock-members.html">List of all members</a> </div> <div class="headertitle"> <div class="title">ost::SemaphoreLock Class Reference</div> </div> </div><!--header--> <div class="contents"> <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 so that only x insta...">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="classost_1_1_semaphore_lock.html#details">More...</a></p> <p><code>#include <<a class="el" href="thread_8h_source.html">thread.h</a>></code></p> <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:adb34354071ac2005870fb78926887a05"><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 class="memdesc:adb34354071ac2005870fb78926887a05"><td class="mdescLeft"> </td><td class="mdescRight">Wait for the semaphore. <a href="#adb34354071ac2005870fb78926887a05">More...</a><br/></td></tr> <tr class="separator:adb34354071ac2005870fb78926887a05"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a59bf7e09b61fd3b900070841fae86597"><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 class="memdesc:a59bf7e09b61fd3b900070841fae86597"><td class="mdescLeft"> </td><td class="mdescRight">Post the semaphore automatically. <a href="#a59bf7e09b61fd3b900070841fae86597">More...</a><br/></td></tr> <tr class="separator:a59bf7e09b61fd3b900070841fae86597"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><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 so that only x insta...">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 so that only x insta...">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="section author"><dt>Author</dt><dd>David Sugar <a href="#" onclick="location.href='mai'+'lto:'+'dyf'+'et'+'@gn'+'u.'+'org'; return false;">dyfet<span style="display: none;">.nosp@m.</span>@gnu<span style="display: none;">.nosp@m.</span>.org</a> <a class="el" href="classost_1_1_semaphore.html" title="A semaphore is generally used as a synchronization object between multiple threads or to protect a li...">Semaphore</a> automatic locker for protected access. </dd></dl> </div><h2 class="groupheader">Constructor & Destructor Documentation</h2> <a class="anchor" id="adb34354071ac2005870fb78926887a05"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <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></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inline</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Wait for the semaphore. </p> </div> </div> <a class="anchor" id="a59bf7e09b61fd3b900070841fae86597"></a> <div class="memitem"> <div class="memproto"> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">ost::SemaphoreLock::~SemaphoreLock </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inline</span></span> </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><!-- contents --> <!-- start footer part --> <hr class="footer"/><address class="footer"><small> Generated on Thu Oct 17 2013 23:24:58 for GNU CommonC++ by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/> </a> 1.8.5 </small></address> </body> </html>