Sophie

Sophie

distrib > Mandriva > current > i586 > media > main-updates > by-pkgid > ed376d6842ea322c25405e7c23b3bc12 > files > 121

libcommoncpp-devel-1.8.0-5.1mdv2010.1.i586.rpm

<!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::Conditional 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&nbsp;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&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="namespaceost.html">ost</a>::<a class="el" href="classost_1_1_conditional.html">Conditional</a>
  </div>
</div>
<div class="contents">
<h1>ost::Conditional Class Reference</h1><!-- doxytag: class="ost::Conditional" -->
<p>A conditional variable synchcronization object for one to one and one to many signal and control events between processes.  
<a href="#_details">More...</a></p>

<p><code>#include &lt;<a class="el" href="thread_8h_source.html">thread.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for ost::Conditional:</div>
<div class="dynsection">
 <div class="center">
  <img src="classost_1_1_conditional.png" usemap="#ost::Conditional_map" alt=""/>
  <map id="ost::Conditional_map" name="ost::Conditional_map">
<area href="classost_1_1_buffer.html" alt="ost::Buffer" shape="rect" coords="0,56,100,80"/>
<area href="classost_1_1_fixed_buffer.html" alt="ost::FixedBuffer" shape="rect" coords="0,112,100,136"/>
</map>
 </div>
</div>

<p><a href="classost_1_1_conditional-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">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#a7d7009cab2b814c82b41d8682a6ebff0">Conditional</a> (const char *id=NULL)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create an instance of a conditional.  <a href="#a7d7009cab2b814c82b41d8682a6ebff0"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#a9772a4c8e522a010a37c63c5ee078384">~Conditional</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Destroy the conditional.  <a href="#a9772a4c8e522a010a37c63c5ee078384"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#a80822e8493bafb68bac637bbf5fe772d">signal</a> (bool broadcast)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Signal a conditional object and a waiting threads.  <a href="#a80822e8493bafb68bac637bbf5fe772d"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#a2cac07a385596391b0fc8c15b8a598e5">wait</a> (<a class="el" href="thread_8h.html#af412159e5cef839836a5e7b19ee75d1c">timeout_t</a> timer=0, bool locked=false)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Wait to be signaled from another thread.  <a href="#a2cac07a385596391b0fc8c15b8a598e5"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#ae3fd225eeae79c24eb7f521f285e8289">enterMutex</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Locks the conditional's mutex for this thread.  <a href="#ae3fd225eeae79c24eb7f521f285e8289"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#a2a3bf89c582dad8ba7e81370fd361668">lock</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">In the future we will use lock in place of enterMutex since the conditional composite is not a recursive mutex, and hence using enterMutex may cause confusion in expectation with the behavior of the <a class="el" href="classost_1_1_mutex.html" title="The Mutex class is used to protect a section of code so that at any given time only...">Mutex</a> class.  <a href="#a2a3bf89c582dad8ba7e81370fd361668"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#adcd3f704ef27fff5501a42185a09471f">tryEnterMutex</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Tries to lock the conditional for the current thread.  <a href="#adcd3f704ef27fff5501a42185a09471f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#a507839fac82a32f946fa5f87d41bef28">test</a> (void)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#acc29112f68c34a9844b3c3dad0d03603">leaveMutex</a> (void)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Leaving a mutex frees that mutex for use by another thread.  <a href="#acc29112f68c34a9844b3c3dad0d03603"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#a8b6126bbb6e58c1b8ef937bebf4af222">unlock</a> (void)</td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>A conditional variable synchcronization object for one to one and one to many signal and control events between processes. </p>
<p><a class="el" href="classost_1_1_conditional.html" title="A conditional variable synchcronization object for one to one and one to many signal...">Conditional</a> variables may wait for and receive signals to notify when to resume or perform operations. Multiple waiting threads may be woken with a broadcast signal.</p>
<dl class="warning"><dt><b>Warning:</b></dt><dd>While this class inherits from <a class="el" href="classost_1_1_mutex.html" title="The Mutex class is used to protect a section of code so that at any given time only...">Mutex</a>, the methods of the class <a class="el" href="classost_1_1_conditional.html" title="A conditional variable synchcronization object for one to one and one to many signal...">Conditional</a> just handle the system conditional variable, so the user is responsible for calling enterMutex and leaveMutex so as to avoid race conditions. Another thing to note is that if you have several threads waiting on one condition, not uncommon in thread pools, each thread must take care to manually unlock the mutex if cancellation occurs. Otherwise the first thread cancelled will deadlock the rest of the thread.</dd></dl>
<dl class="author"><dt><b>Author:</b></dt><dd>David Sugar conditional. </dd></dl>
<hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a7d7009cab2b814c82b41d8682a6ebff0"></a><!-- doxytag: member="ost::Conditional::Conditional" ref="a7d7009cab2b814c82b41d8682a6ebff0" args="(const char *id=NULL)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ost::Conditional::Conditional </td>
          <td>(</td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>id</em> = <code>NULL</code></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Create an instance of a conditional. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>id</em>&nbsp;</td><td>name of conditional, optional for deadlock testing. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a9772a4c8e522a010a37c63c5ee078384"></a><!-- doxytag: member="ost::Conditional::~Conditional" ref="a9772a4c8e522a010a37c63c5ee078384" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual ost::Conditional::~Conditional </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Destroy the conditional. </p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="ae3fd225eeae79c24eb7f521f285e8289"></a><!-- doxytag: member="ost::Conditional::enterMutex" ref="ae3fd225eeae79c24eb7f521f285e8289" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ost::Conditional::enterMutex </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>Locks the conditional's mutex for this thread. </p>
<p>Remember that Conditional's mutex is NOT a recursive mutex!</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classost_1_1_conditional.html#acc29112f68c34a9844b3c3dad0d03603" title="Leaving a mutex frees that mutex for use by another thread.">leaveMutex</a> </dd></dl>

</div>
</div>
<a class="anchor" id="acc29112f68c34a9844b3c3dad0d03603"></a><!-- doxytag: member="ost::Conditional::leaveMutex" ref="acc29112f68c34a9844b3c3dad0d03603" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ost::Conditional::leaveMutex </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>Leaving a mutex frees that mutex for use by another thread. </p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classost_1_1_conditional.html#ae3fd225eeae79c24eb7f521f285e8289" title="Locks the conditional&#39;s mutex for this thread.">enterMutex</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a2a3bf89c582dad8ba7e81370fd361668"></a><!-- doxytag: member="ost::Conditional::lock" ref="a2a3bf89c582dad8ba7e81370fd361668" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ost::Conditional::lock </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>In the future we will use lock in place of enterMutex since the conditional composite is not a recursive mutex, and hence using enterMutex may cause confusion in expectation with the behavior of the <a class="el" href="classost_1_1_mutex.html" title="The Mutex class is used to protect a section of code so that at any given time only...">Mutex</a> class. </p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classost_1_1_conditional.html#ae3fd225eeae79c24eb7f521f285e8289" title="Locks the conditional&#39;s mutex for this thread.">enterMutex</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a80822e8493bafb68bac637bbf5fe772d"></a><!-- doxytag: member="ost::Conditional::signal" ref="a80822e8493bafb68bac637bbf5fe772d" args="(bool broadcast)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ost::Conditional::signal </td>
          <td>(</td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>broadcast</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Signal a conditional object and a waiting threads. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>broadcast</em>&nbsp;</td><td>this signal to all waiting threads if true. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a507839fac82a32f946fa5f87d41bef28"></a><!-- doxytag: member="ost::Conditional::test" ref="a507839fac82a32f946fa5f87d41bef28" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool ost::Conditional::test </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="adcd3f704ef27fff5501a42185a09471f"></a><!-- doxytag: member="ost::Conditional::tryEnterMutex" ref="adcd3f704ef27fff5501a42185a09471f" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool ost::Conditional::tryEnterMutex </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>Tries to lock the conditional for the current thread. </p>
<p>Behaves like <a class="el" href="classost_1_1_conditional.html#ae3fd225eeae79c24eb7f521f285e8289" title="Locks the conditional&#39;s mutex for this thread.">enterMutex</a> , except that it doesn't block the calling thread.</p>
<dl class="return"><dt><b>Returns:</b></dt><dd>true if locking the mutex was succesful otherwise false</dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classost_1_1_conditional.html#ae3fd225eeae79c24eb7f521f285e8289" title="Locks the conditional&#39;s mutex for this thread.">enterMutex</a> </dd>
<dd>
<a class="el" href="classost_1_1_conditional.html#acc29112f68c34a9844b3c3dad0d03603" title="Leaving a mutex frees that mutex for use by another thread.">leaveMutex</a> </dd></dl>

</div>
</div>
<a class="anchor" id="a8b6126bbb6e58c1b8ef937bebf4af222"></a><!-- doxytag: member="ost::Conditional::unlock" ref="a8b6126bbb6e58c1b8ef937bebf4af222" args="(void)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ost::Conditional::unlock </td>
          <td>(</td>
          <td class="paramtype">void&nbsp;</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

</div>
</div>
<a class="anchor" id="a2cac07a385596391b0fc8c15b8a598e5"></a><!-- doxytag: member="ost::Conditional::wait" ref="a2cac07a385596391b0fc8c15b8a598e5" args="(timeout_t timer=0, bool locked=false)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool ost::Conditional::wait </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="thread_8h.html#af412159e5cef839836a5e7b19ee75d1c">timeout_t</a>&nbsp;</td>
          <td class="paramname"> <em>timer</em> = <code>0</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&nbsp;</td>
          <td class="paramname"> <em>locked</em> = <code>false</code></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Wait to be signaled from another thread. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>timer</em>&nbsp;</td><td>time period to wait. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>locked</em>&nbsp;</td><td>flag if already locked the mutex. </td></tr>
  </table>
  </dd>
</dl>

</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&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>