Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > bfea28f33e7373c31a33dc7387b2a0be > files > 198

loki-lib-doc-0.1.7-2.fc12.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Loki: Loki::SleepLevelMutex 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.5.8 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</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>
    <li>
      <form action="search.php" method="get">
        <table cellspacing="0" cellpadding="0" border="0">
          <tr>
            <td><label>&nbsp;<u>S</u>earch&nbsp;for&nbsp;</label></td>
            <td><input type="text" name="query" value="" size="20" accesskey="s"/></td>
          </tr>
        </table>
      </form>
    </li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="classes.html"><span>Class&nbsp;Index</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="navpath"><a class="el" href="a00192.html">Loki</a>::<a class="el" href="a00126.html">SleepLevelMutex</a>
  </div>
</div>
<div class="contents">
<h1>Loki::SleepLevelMutex Class Reference</h1><!-- doxytag: class="Loki::SleepLevelMutex" --><!-- doxytag: inherits="Loki::SpinLevelMutex" --><code>#include &lt;LevelMutex.h&gt;</code>
<p>
<div class="dynheader">
Inheritance diagram for Loki::SleepLevelMutex:</div>
<div class="dynsection">
<center><font size="2">[<a target="top" href="graph_legend.html">legend</a>]</font></center></div>
<div class="dynheader">
Collaboration diagram for Loki::SleepLevelMutex:</div>
<div class="dynsection">
<center><font size="2">[<a target="top" href="graph_legend.html">legend</a>]</font></center></div>

<p>
<a href="a00333.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="a00126.html#89785c46dc2bde328e1908e25d6b747b">SleepLevelMutex</a> (unsigned int level)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="4c415349db989e7f2a8f2e02cbf9db88"></a><!-- doxytag: member="Loki::SleepLevelMutex::~SleepLevelMutex" ref="4c415349db989e7f2a8f2e02cbf9db88" args="(void)" -->
virtual&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00126.html#4c415349db989e7f2a8f2e02cbf9db88">~SleepLevelMutex</a> (void)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destructs the mutex. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual MutexErrors::Type&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00126.html#e0f17a3b7641466c7611f5921d0c95e6">Lock</a> (void) volatile</td></tr>

</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Implements a sleeping loop to wait for the mutex to unlock.<p>
<dl class="user" compact><dt><b>Purpose</b></dt><dd>Since this class puts the thread to sleep for short intervals, you can use this class for most of your mutexes. Especially for locking any high level resources where any one operation on the resouce consumes many CPU cycles. The purpose of this mutex is to reduce the number of CPU cycles spent in idle loops. All SleepLevelMutex's should have higher levels than all your SpinLevelMutex's.</dd></dl>
<dl class="user" compact><dt><b>Dependence on SpinLevelMutex</b></dt><dd>This utilizes <a class="el" href="a00133.html">SpinLevelMutex</a> so it does not have to re-implement the DoTryLock and DoUnlock functions the same way. All it really needs is a DoLock function and the amount of time it should sleep if an attempt to lock a function fails. </dd></dl>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="89785c46dc2bde328e1908e25d6b747b"></a><!-- doxytag: member="Loki::SleepLevelMutex::SleepLevelMutex" ref="89785c46dc2bde328e1908e25d6b747b" args="(unsigned int level)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Loki::SleepLevelMutex::SleepLevelMutex           </td>
          <td>(</td>
          <td class="paramtype">unsigned int&nbsp;</td>
          <td class="paramname"> <em>level</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [explicit]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Constructs a levelized mutex that puts threads to sleep while they wait for another thread to unlock the mutex. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>level</em>&nbsp;</td><td>Level of this mutex. </td></tr>
  </table>
</dl>

</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="e0f17a3b7641466c7611f5921d0c95e6"></a><!-- doxytag: member="Loki::SleepLevelMutex::Lock" ref="e0f17a3b7641466c7611f5921d0c95e6" args="(void) volatile" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">MutexErrors::Type Loki::SleepLevelMutex::Lock           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td> volatile<code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Attempts to lock a mutex, and if it fails, then sleeps for a while before attempting again. 
<p>Reimplemented from <a class="el" href="a00133.html">Loki::SpinLevelMutex</a>.</p>

</div>
</div><p>
<hr>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="a00158.html">LevelMutex.h</a><li><a class="el" href="a00157.html">LevelMutex.cpp</a></ul>
</div>
<hr size="1"><address style="text-align: right;"><small>Generated on Thu Jan 29 18:51:43 2009 for Loki by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
</body>
</html>