Sophie

Sophie

distrib > Mandriva > 2007.0 > i586 > by-pkgid > ad1ba1135a9c9eeffc2e538163e00373 > files > 232

libCommonC++2_1.4-devel-1.4.1-1mdv2007.0.i586.rpm

<!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::MutexLock 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&nbsp;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&nbsp;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&nbsp;List</span></a></li>
    <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
    <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
    <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
  </ul></div>
<div class="nav">
<a class="el" href="namespaceost.html">ost</a>::<a class="el" href="classost_1_1_mutex_lock.html">MutexLock</a></div>
<h1>ost::MutexLock Class Reference</h1><!-- doxytag: class="ost::MutexLock" -->The <a class="el" href="classost_1_1_mutex_lock.html">MutexLock</a> class is used to protect a section of code so that at any given time only a single thread can perform the protected operation.Mutex automatic locker for protected access.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="thread_8h-source.html">thread.h</a>&gt;</code>
<p>
<a href="classost_1_1_mutex_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">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_mutex_lock.html#edb21cfad9b0f1200d055fb69efa2546">MutexLock</a> (<a class="el" href="classost_1_1_mutex.html">Mutex</a> &amp;_mutex)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Acquire the mutex.  <a href="#edb21cfad9b0f1200d055fb69efa2546"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_mutex_lock.html#58bba3406d89b40c8bd3e9ac389b920c">~MutexLock</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Release the mutex automatically.  <a href="#58bba3406d89b40c8bd3e9ac389b920c"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
The <a class="el" href="classost_1_1_mutex_lock.html">MutexLock</a> class is used to protect a section of code so that at any given time only a single thread can perform the protected operation.Mutex automatic locker for protected access. 
<p>
It use <a class="el" href="classost_1_1_mutex.html">Mutex</a> to protect operation. Using this class is usefull and exception safe. The mutex that has been locked is automatically released when the function call stack falls out of scope, so one doesnt have to remember to unlock the mutex at each function return.<p>
A common use is<p>
void func_to_protect() { <a class="el" href="classost_1_1_mutex_lock.html">MutexLock</a> lock(mutex); ... operation ... }<p>
NOTE: do not declare variable as "MutexLock (mutex)", the mutex will be released at statement end.<p>
<dl compact><dt><b>Author:</b></dt><dd>Frediano Ziglio &lt;<a href="mailto:freddy77@angelfire.com">freddy77@angelfire.com</a>&gt; </dd></dl>

<p>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="edb21cfad9b0f1200d055fb69efa2546"></a><!-- doxytag: member="ost::MutexLock::MutexLock" ref="edb21cfad9b0f1200d055fb69efa2546" args="(Mutex &amp;_mutex)" --><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::MutexLock::MutexLock           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top"><a class="el" href="classost_1_1_mutex.html">Mutex</a> &amp;&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>_mutex</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [inline]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Acquire the mutex. 
<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>_mutex</em>&nbsp;</td><td>reference to mutex to aquire. </td></tr>
  </table>
</dl>
    </td>
  </tr>
</table>
<a class="anchor" name="58bba3406d89b40c8bd3e9ac389b920c"></a><!-- doxytag: member="ost::MutexLock::~MutexLock" ref="58bba3406d89b40c8bd3e9ac389b920c" 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::MutexLock::~MutexLock           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [inline]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Release the mutex 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&nbsp;
<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>