Sophie

Sophie

distrib > Mandriva > 2011.0 > i586 > by-pkgid > 092973e3430682b17a7d74261285ae23 > files > 134

loki-lib-doc-0.1.7-1.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::MultiMutexLocker 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="a00080.html">MultiMutexLocker</a>
  </div>
</div>
<div class="contents">
<h1>Loki::MultiMutexLocker Class Reference</h1><!-- doxytag: class="Loki::MultiMutexLocker" --><code>#include &lt;LevelMutex.h&gt;</code>
<p>

<p>
<a href="a00340.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="a00080.html#aa646ae058e3273651f89bfbb276cf42">MultiMutexLocker</a> (<a class="el" href="a00071.html#76a0315d91234f5066c75660a9f27a7f">LevelMutexInfo::MutexContainer</a> &amp;mutexes, bool lock=true)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00080.html#a88fcf2068f0c4292e2f25fcd29c3e33">MultiMutexLocker</a> (<a class="el" href="a00071.html#76a0315d91234f5066c75660a9f27a7f">LevelMutexInfo::MutexContainer</a> &amp;mutexes, unsigned int milliSeconds, bool lock=true)</td></tr>

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

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destructs the locker, and determines if it needs to unlock the mutexes. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00080.html#9ce26d13eb156c9a8b7fa6228bf6724f">Lock</a> (void)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00080.html#18bfdec10dd2e65e128d64a80e42407f">Unlock</a> (void)</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="1bdfd6380329fff07890d2bc0e67427f"></a><!-- doxytag: member="Loki::MultiMutexLocker::IsLocked" ref="1bdfd6380329fff07890d2bc0e67427f" args="(void) const " -->
bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00080.html#1bdfd6380329fff07890d2bc0e67427f">IsLocked</a> (void) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns true if the mutexes are locked by this object. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="1b95c9bfa8ff0737d0afd67d9820f67f"></a><!-- doxytag: member="Loki::MultiMutexLocker::GetMutexes" ref="1b95c9bfa8ff0737d0afd67d9820f67f" args="(void) const " -->
const <br class="typebreak">
<a class="el" href="a00071.html#76a0315d91234f5066c75660a9f27a7f">LevelMutexInfo::MutexContainer</a> &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00080.html#1b95c9bfa8ff0737d0afd67d9820f67f">GetMutexes</a> (void) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Provides access to the collection of mutexes controlled by this. <br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
You can place an instance of this as a local variable inside a function to lock a collection of mutexes. It locks them if no error occurs, or throws an exception if one does happen. When the function ends, the destructor determines if it needs to unlock the mutexes. This RAII technique insures the mutexes get unlocked even when exceptions occur. You will also have to construct a MutexContainer as a local object within the same function. <hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="aa646ae058e3273651f89bfbb276cf42"></a><!-- doxytag: member="Loki::MultiMutexLocker::MultiMutexLocker" ref="aa646ae058e3273651f89bfbb276cf42" args="(LevelMutexInfo::MutexContainer &amp;mutexes, bool lock=true)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Loki::MultiMutexLocker::MultiMutexLocker           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="a00071.html#76a0315d91234f5066c75660a9f27a7f">LevelMutexInfo::MutexContainer</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>mutexes</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>lock</em> = <code>true</code></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [explicit]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Creates an object to lock and unlock a collection of mutexes for a function. This will throw if an attempt to lock any mutex fails. If an exception occurs, it unlocks mutexes it previously locked. <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 a collection of mutexes. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>lock</em>&nbsp;</td><td>True if function wants to lock the mutex as this gets constructed. </td></tr>
  </table>
</dl>

<p>References <a class="el" href="a00242.html#l00316">Loki::LevelMutexInfo::MultiLock()</a>.</p>

<p>
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>

</div>
</div><p>
<a class="anchor" name="a88fcf2068f0c4292e2f25fcd29c3e33"></a><!-- doxytag: member="Loki::MultiMutexLocker::MultiMutexLocker" ref="a88fcf2068f0c4292e2f25fcd29c3e33" args="(LevelMutexInfo::MutexContainer &amp;mutexes, unsigned int milliSeconds, bool lock=true)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Loki::MultiMutexLocker::MultiMutexLocker           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="a00071.html#76a0315d91234f5066c75660a9f27a7f">LevelMutexInfo::MutexContainer</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>mutexes</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&nbsp;</td>
          <td class="paramname"> <em>milliSeconds</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>lock</em> = <code>true</code></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Creates an object to lock and unlock a collection of mutexes for a function. This waits a specified amount of time for other threads to unlock each mutex that is locked. This will throw if an attempt to lock any mutex fails. If an exception occurs, it unlocks mutexes it previously locked. <dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>mutexes</em>&nbsp;</td><td>Reference to a collection of mutexes. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>milliSeconds</em>&nbsp;</td><td>Amount of time to wait for another thread to unlock the mutex. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>lock</em>&nbsp;</td><td>True if function wants to lock the mutexes as this gets constructed. </td></tr>
  </table>
</dl>

<p>References <a class="el" href="a00242.html#l00316">Loki::LevelMutexInfo::MultiLock()</a>.</p>

<p>
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>

</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="9ce26d13eb156c9a8b7fa6228bf6724f"></a><!-- doxytag: member="Loki::MultiMutexLocker::Lock" ref="9ce26d13eb156c9a8b7fa6228bf6724f" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Loki::MultiMutexLocker::Lock           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
You can call this to lock (or relock) the mutexes. In theory, you can lock and unlock mutexes several times within a function in order to give other threads access to resources while this function does not need them. <dl class="return" compact><dt><b>Returns:</b></dt><dd>True if mutex is locked by this, else false if not locked. </dd></dl>

<p>References <a class="el" href="a00242.html#l00316">Loki::LevelMutexInfo::MultiLock()</a>.</p>

<p>
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>

</div>
</div><p>
<a class="anchor" name="18bfdec10dd2e65e128d64a80e42407f"></a><!-- doxytag: member="Loki::MultiMutexLocker::Unlock" ref="18bfdec10dd2e65e128d64a80e42407f" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Loki::MultiMutexLocker::Unlock           </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
You can call this to unlock the mutexes before the destructor does it. By unlocking the mutexes before returning, the function can do other operations without making other threads wait too long. <dl class="return" compact><dt><b>Returns:</b></dt><dd>True if unlocked by this, else false if not unlocked by this. (Which is not the same as whether the mutex itself is locked or not by another thread.) </dd></dl>

<p>References <a class="el" href="a00242.html#l00479">Loki::LevelMutexInfo::MultiUnlock()</a>.</p>

<p>
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>

</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>