⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 classsemaphore.html

📁 美国COPLEY驱动器,程序开发工具之一.
💻 HTML
字号:
<!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>Copley Motion Library: Semaphore Class Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.4.4 --><div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="globals.html">File&nbsp;Members</a></div><h1>Semaphore Class Reference</h1><!-- doxytag: class="Semaphore" --><a href="classSemaphore-members.html">List of all members.</a><hr><a name="_details"></a><h2>Detailed Description</h2>Generic semaphore class. <p>Semaphores can be used to allow multiple threads to share a pool of shared resources. Semaphores can be used like mutexes, however they also implement timeouts and multiple resource counts.<p><p>Definition at line <a class="el" href="CML__Threads_8h-source.html#l00202">202</a> of file <a class="el" href="CML__Threads_8h-source.html">CML_Threads.h</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="classSemaphore.html#a0">Semaphore</a> (<a class="el" href="CML__Utils_8h.html#a9">int32</a> count=0)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create a new semaphore object.  <a href="#a0"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classSemaphore.html#a1">~Semaphore</a> ()</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Free any system resources associated with this semaphore.  <a href="#a1"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">const <a class="el" href="classError.html">Error</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classSemaphore.html#a2">Get</a> (<a class="el" href="CML__Utils_8h.html#a9">int32</a> timeout=-1)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the semaphore with an optional timeout.  <a href="#a2"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">const <a class="el" href="classError.html">Error</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classSemaphore.html#a3">Put</a> (void)</td></tr><tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Increase the count of the semaphore object.  <a href="#a3"></a><br></td></tr></table><hr><h2>Constructor &amp; Destructor Documentation</h2><a class="anchor" name="a0"></a><!-- doxytag: member="Semaphore::Semaphore" ref="a0" args="(int32 count=0)" --><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"><a class="el" href="classSemaphore.html">Semaphore</a>           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top"><a class="el" href="CML__Utils_8h.html#a9">int32</a>&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>count</em> = <code>0</code>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Create a new semaphore object. <p>If a count is passed, then the initial semaphore count will be initialized to that value. If no count is passed, then a count of zero is used.<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>count</em>&nbsp;</td><td>The initial count of the semaphore. The semaphore's Get method may be called that many times before any thread will block on it. </td></tr>  </table></dl>    </td>  </tr></table><a class="anchor" name="a1"></a><!-- doxytag: member="Semaphore::~Semaphore" ref="a1" 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">virtual ~<a class="el" href="classSemaphore.html">Semaphore</a>           </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> [virtual]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Free any system resources associated with this semaphore. <p>Any threads blocking on the semaphore should return from the <a class="el" href="classSemaphore.html#a2">Get()</a> call with an error indication.     </td>  </tr></table><hr><h2>Member Function Documentation</h2><a class="anchor" name="a2"></a><!-- doxytag: member="Semaphore::Get" ref="a2" args="(int32 timeout=-1)" --><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">const <a class="el" href="classError.html">Error</a>* Get           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top"><a class="el" href="CML__Utils_8h.html#a9">int32</a>&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>timeout</em> = <code>-1</code>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Get the semaphore with an optional timeout. <p>An error is returned if the timeout expires before the semaphore is acquired. <dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign="top"></td><td valign="top"><em>timeout</em>&nbsp;</td><td>The timeout in milliseconds. Any negative value will cause the thread to wait indefinitely. If a timeout of zero is specified, the calling thread will return a timeout error without blocking if the semaphore is not available. </td></tr>  </table></dl><dl compact><dt><b>Returns:</b></dt><dd>An error code indicating success or failure. </dd></dl>    </td>  </tr></table><a class="anchor" name="a3"></a><!-- doxytag: member="Semaphore::Put" ref="a3" args="(void)" --><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">const <a class="el" href="classError.html">Error</a>* Put           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">void&nbsp;</td>          <td class="mdname1" valign="top" nowrap>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Increase the count of the semaphore object. <p>If any threads are pending on the object, then the highest priority one will be made eligible to run. <dl compact><dt><b>Returns:</b></dt><dd>An error object </dd></dl>    </td>  </tr></table><hr>The documentation for this class was generated from the following file:<ul><li><a class="el" href="CML__Threads_8h-source.html">CML_Threads.h</a></ul><hr><address style="align: right;"><small>Copley Motion Library, Copyright (c) 2002-2003<a href="http://www.copleycontrols.com"><img src="CCC_logo.gif" alt="Copley Controls Corp." align="middle" border=0 ></a></small></address></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -