Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > b293cf61b174f6cb974e48c9096dc9b3 > files > 119

lib64commoncpp-devel-1.8.1-7.mga4.x86_64.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"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>GNU CommonC++: ost::Conditional 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&#160;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&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;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_conditional.html">Conditional</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classost_1_1_conditional-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">ost::Conditional Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>A conditional variable synchcronization object for one to one and one to many signal and control events between processes.  
 <a href="classost_1_1_conditional.html#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="dyncontent">
 <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" title="The buffer class represents an IPC service that is built upon a buffer of fixed capacity that can be ..." alt="ost::Buffer" shape="rect" coords="0,56,100,80"/>
<area href="classost_1_1_fixed_buffer.html" title="A buffer class that holds a known capacity of fixed sized objects defined during creation. " alt="ost::FixedBuffer" shape="rect" coords="0,112,100,136"/>
</map>
 </div></div>
<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:a7d7009cab2b814c82b41d8682a6ebff0"><td class="memItemLeft" align="right" valign="top">&#160;</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 class="memdesc:a7d7009cab2b814c82b41d8682a6ebff0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create an instance of a conditional.  <a href="#a7d7009cab2b814c82b41d8682a6ebff0">More...</a><br/></td></tr>
<tr class="separator:a7d7009cab2b814c82b41d8682a6ebff0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9772a4c8e522a010a37c63c5ee078384"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#a9772a4c8e522a010a37c63c5ee078384">~Conditional</a> ()</td></tr>
<tr class="memdesc:a9772a4c8e522a010a37c63c5ee078384"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroy the conditional.  <a href="#a9772a4c8e522a010a37c63c5ee078384">More...</a><br/></td></tr>
<tr class="separator:a9772a4c8e522a010a37c63c5ee078384"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a80822e8493bafb68bac637bbf5fe772d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#a80822e8493bafb68bac637bbf5fe772d">signal</a> (bool broadcast)</td></tr>
<tr class="memdesc:a80822e8493bafb68bac637bbf5fe772d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Signal a conditional object and a waiting threads.  <a href="#a80822e8493bafb68bac637bbf5fe772d">More...</a><br/></td></tr>
<tr class="separator:a80822e8493bafb68bac637bbf5fe772d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2cac07a385596391b0fc8c15b8a598e5"><td class="memItemLeft" align="right" valign="top">bool&#160;</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 class="memdesc:a2cac07a385596391b0fc8c15b8a598e5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wait to be signaled from another thread.  <a href="#a2cac07a385596391b0fc8c15b8a598e5">More...</a><br/></td></tr>
<tr class="separator:a2cac07a385596391b0fc8c15b8a598e5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae3fd225eeae79c24eb7f521f285e8289"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#ae3fd225eeae79c24eb7f521f285e8289">enterMutex</a> (void)</td></tr>
<tr class="memdesc:ae3fd225eeae79c24eb7f521f285e8289"><td class="mdescLeft">&#160;</td><td class="mdescRight">Locks the conditional's mutex for this thread.  <a href="#ae3fd225eeae79c24eb7f521f285e8289">More...</a><br/></td></tr>
<tr class="separator:ae3fd225eeae79c24eb7f521f285e8289"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2a3bf89c582dad8ba7e81370fd361668"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#a2a3bf89c582dad8ba7e81370fd361668">lock</a> (void)</td></tr>
<tr class="memdesc:a2a3bf89c582dad8ba7e81370fd361668"><td class="mdescLeft">&#160;</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 a single thread c...">Mutex</a> class.  <a href="#a2a3bf89c582dad8ba7e81370fd361668">More...</a><br/></td></tr>
<tr class="separator:a2a3bf89c582dad8ba7e81370fd361668"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adcd3f704ef27fff5501a42185a09471f"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#adcd3f704ef27fff5501a42185a09471f">tryEnterMutex</a> (void)</td></tr>
<tr class="memdesc:adcd3f704ef27fff5501a42185a09471f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Tries to lock the conditional for the current thread.  <a href="#adcd3f704ef27fff5501a42185a09471f">More...</a><br/></td></tr>
<tr class="separator:adcd3f704ef27fff5501a42185a09471f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a507839fac82a32f946fa5f87d41bef28"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#a507839fac82a32f946fa5f87d41bef28">test</a> (void)</td></tr>
<tr class="separator:a507839fac82a32f946fa5f87d41bef28"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acc29112f68c34a9844b3c3dad0d03603"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#acc29112f68c34a9844b3c3dad0d03603">leaveMutex</a> (void)</td></tr>
<tr class="memdesc:acc29112f68c34a9844b3c3dad0d03603"><td class="mdescLeft">&#160;</td><td class="mdescRight">Leaving a mutex frees that mutex for use by another thread.  <a href="#acc29112f68c34a9844b3c3dad0d03603">More...</a><br/></td></tr>
<tr class="separator:acc29112f68c34a9844b3c3dad0d03603"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8b6126bbb6e58c1b8ef937bebf4af222"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classost_1_1_conditional.html#a8b6126bbb6e58c1b8ef937bebf4af222">unlock</a> (void)</td></tr>
<tr class="separator:a8b6126bbb6e58c1b8ef937bebf4af222"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><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 and control even...">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="section warning"><dt>Warning</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 a single thread c...">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 and control even...">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="section author"><dt>Author</dt><dd>David Sugar conditional. </dd></dl>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a7d7009cab2b814c82b41d8682a6ebff0"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ost::Conditional::Conditional </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>id</em> = <code>NULL</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create an instance of a conditional. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">id</td><td>name of conditional, optional for deadlock testing. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a9772a4c8e522a010a37c63c5ee078384"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual ost::Conditional::~Conditional </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Destroy the conditional. </p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="ae3fd225eeae79c24eb7f521f285e8289"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ost::Conditional::enterMutex </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Locks the conditional's mutex for this thread. </p>
<p>Remember that <a class="el" href="classost_1_1_conditional.html" title="A conditional variable synchcronization object for one to one and one to many signal and control even...">Conditional</a>'s mutex is NOT a recursive mutex!</p>
<dl class="section see"><dt>See Also</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>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ost::Conditional::leaveMutex </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Leaving a mutex frees that mutex for use by another thread. </p>
<dl class="section see"><dt>See Also</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>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void ost::Conditional::lock </td>
          <td>(</td>
          <td class="paramtype">void&#160;</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>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 a single thread c...">Mutex</a> class. </p>
<dl class="section see"><dt>See Also</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>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ost::Conditional::signal </td>
          <td>(</td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>broadcast</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Signal a conditional object and a waiting threads. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">broadcast</td><td>this signal to all waiting threads if true. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a507839fac82a32f946fa5f87d41bef28"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">bool ost::Conditional::test </td>
          <td>(</td>
          <td class="paramtype">void&#160;</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">

</div>
</div>
<a class="anchor" id="adcd3f704ef27fff5501a42185a09471f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool ost::Conditional::tryEnterMutex </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</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="section return"><dt>Returns</dt><dd>true if locking the mutex was succesful otherwise false</dd></dl>
<dl class="section see"><dt>See Also</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>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void ost::Conditional::unlock </td>
          <td>(</td>
          <td class="paramtype">void&#160;</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">

</div>
</div>
<a class="anchor" id="a2cac07a385596391b0fc8c15b8a598e5"></a>
<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>&#160;</td>
          <td class="paramname"><em>timer</em> = <code>0</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>locked</em> = <code>false</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Wait to be signaled from another thread. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">timer</td><td>time period to wait. </td></tr>
    <tr><td class="paramname">locked</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><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Oct 17 2013 23:24:58 for GNU CommonC++ by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>