📄 semaphor_8h-source.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>semaphor.h Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.18 --><center><a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center><hr><h1>semaphor.h</h1><a href="semaphor_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span>00002 <span class="comment"> * semaphor.h</span>00003 <span class="comment"> *</span>00004 <span class="comment"> * Thread synchronisation semaphore class.</span>00005 <span class="comment"> *</span>00006 <span class="comment"> * Portable Windows Library</span>00007 <span class="comment"> *</span>00008 <span class="comment"> * Copyright (c) 1993-1998 Equivalence Pty. Ltd.</span>00009 <span class="comment"> *</span>00010 <span class="comment"> * The contents of this file are subject to the Mozilla Public License</span>00011 <span class="comment"> * Version 1.0 (the "License"); you may not use this file except in</span>00012 <span class="comment"> * compliance with the License. You may obtain a copy of the License at</span>00013 <span class="comment"> * http://www.mozilla.org/MPL/</span>00014 <span class="comment"> *</span>00015 <span class="comment"> * Software distributed under the License is distributed on an "AS IS"</span>00016 <span class="comment"> * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See</span>00017 <span class="comment"> * the License for the specific language governing rights and limitations</span>00018 <span class="comment"> * under the License.</span>00019 <span class="comment"> *</span>00020 <span class="comment"> * The Original Code is Portable Windows Library.</span>00021 <span class="comment"> *</span>00022 <span class="comment"> * The Initial Developer of the Original Code is Equivalence Pty. Ltd.</span>00023 <span class="comment"> *</span>00024 <span class="comment"> * Portions are Copyright (C) 1993 Free Software Foundation, Inc.</span>00025 <span class="comment"> * All Rights Reserved.</span>00026 <span class="comment"> *</span>00027 <span class="comment"> * Contributor(s): ______________________________________.</span>00028 <span class="comment"> *</span>00029 <span class="comment"> * $Log: semaphor.h,v $</span>00030 <span class="comment"> * Revision 1.18 2003/09/17 05:41:59 csoutheren</span>00031 <span class="comment"> * Removed recursive includes</span>00032 <span class="comment"> *</span>00033 <span class="comment"> * Revision 1.17 2003/09/17 01:18:02 csoutheren</span>00034 <span class="comment"> * Removed recursive include file system and removed all references</span>00035 <span class="comment"> * to deprecated coooperative threading support</span>00036 <span class="comment"> *</span>00037 <span class="comment"> * Revision 1.16 2002/09/16 01:08:59 robertj</span>00038 <span class="comment"> * Added #define so can select if #pragma interface/implementation is used on</span>00039 <span class="comment"> * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.</span>00040 <span class="comment"> *</span>00041 <span class="comment"> * Revision 1.15 2002/01/23 04:26:36 craigs</span>00042 <span class="comment"> * Added copy constructors for PSemaphore, PMutex and PSyncPoint to allow</span>00043 <span class="comment"> * use of default copy constructors for objects containing instances of</span>00044 <span class="comment"> * these classes</span>00045 <span class="comment"> *</span>00046 <span class="comment"> * Revision 1.14 2001/11/23 00:55:18 robertj</span>00047 <span class="comment"> * Changed PWaitAndSignal so works inside const functions.</span>00048 <span class="comment"> *</span>00049 <span class="comment"> * Revision 1.13 2001/06/01 04:00:21 yurik</span>00050 <span class="comment"> * Removed dependency on obsolete function</span>00051 <span class="comment"> *</span>00052 <span class="comment"> * Revision 1.12 2001/05/22 12:49:32 robertj</span>00053 <span class="comment"> * Did some seriously wierd rewrite of platform headers to eliminate the</span>00054 <span class="comment"> * stupid GNU compiler warning about braces not matching.</span>00055 <span class="comment"> *</span>00056 <span class="comment"> * Revision 1.11 2001/04/23 00:34:29 robertj</span>00057 <span class="comment"> * Added ability for PWaitAndSignal to not wait on semaphore.</span>00058 <span class="comment"> *</span>00059 <span class="comment"> * Revision 1.10 2001/01/27 23:40:09 yurik</span>00060 <span class="comment"> * WinCE port-related - CreateEvent used instead of CreateSemaphore</span>00061 <span class="comment"> *</span>00062 <span class="comment"> * Revision 1.9 2000/12/19 22:20:26 dereks</span>00063 <span class="comment"> * Add video channel classes to connect to the PwLib PVideoInputDevice class.</span>00064 <span class="comment"> * Add PFakeVideoInput class to generate test images for video.</span>00065 <span class="comment"> *</span>00066 <span class="comment"> * Revision 1.8 1999/03/09 02:59:50 robertj</span>00067 <span class="comment"> * Changed comments to doc++ compatible documentation.</span>00068 <span class="comment"> *</span>00069 <span class="comment"> * Revision 1.7 1999/02/16 08:11:10 robertj</span>00070 <span class="comment"> * MSVC 6.0 compatibility changes.</span>00071 <span class="comment"> *</span>00072 <span class="comment"> * Revision 1.6 1998/11/19 05:17:37 robertj</span>00073 <span class="comment"> * Added PWaitAndSignal class for easier mutexing.</span>00074 <span class="comment"> *</span>00075 <span class="comment"> * Revision 1.5 1998/09/23 06:21:19 robertj</span>00076 <span class="comment"> * Added open source copyright license.</span>00077 <span class="comment"> *</span>00078 <span class="comment"> * Revision 1.4 1998/03/20 03:16:11 robertj</span>00079 <span class="comment"> * Added special classes for specific sepahores, PMutex and PSyncPoint.</span>00080 <span class="comment"> *</span>00081 <span class="comment"> * Revision 1.3 1995/12/10 11:34:50 robertj</span>00082 <span class="comment"> * Fixed incorrect order of parameters in semaphore constructor.</span>00083 <span class="comment"> *</span>00084 <span class="comment"> * Revision 1.2 1995/11/21 11:49:42 robertj</span>00085 <span class="comment"> * Added timeout on semaphore wait.</span>00086 <span class="comment"> *</span>00087 <span class="comment"> * Revision 1.1 1995/08/01 21:41:24 robertj</span>00088 <span class="comment"> * Initial revision</span>00089 <span class="comment"> *</span>00090 <span class="comment"> */</span>00091 00092 <span class="preprocessor">#ifndef _PSEMAPHORE</span>00093 <span class="preprocessor"></span><span class="preprocessor">#define _PSEMAPHORE</span>00094 <span class="preprocessor"></span>00095 <span class="preprocessor">#ifdef P_USE_PRAGMA</span>00096 <span class="preprocessor"></span><span class="preprocessor">#pragma interface</span>00097 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00098 <span class="preprocessor"></span>00099 <span class="preprocessor">#include <limits.h></span>00100 00101 <a name="l00120"></a><a class="code" href="classPWaitAndSignal.html">00120</a> <span class="keyword">class </span><a class="code" href="classPWaitAndSignal.html">PWaitAndSignal</a> {00121 <span class="keyword">public</span>:00126 <a class="code" href="classPWaitAndSignal.html#a0">PWaitAndSignal</a>(00127 <span class="keyword">const</span> <a class="code" href="classPSemaphore.html">PSemaphore</a> & sem, 00128 BOOL wait = TRUE 00129 );00134 <a class="code" href="classPWaitAndSignal.html#a1">~PWaitAndSignal</a>();00135 00136 <span class="keyword">protected</span>:<a name="l00137"></a><a class="code" href="classPWaitAndSignal.html#n0">00137</a> <a class="code" href="classPSemaphore.html">PSemaphore</a> & <a class="code" href="classPWaitAndSignal.html#n0">semaphore</a>;00138 };00139 00140 <a name="l00174"></a><a class="code" href="classPSemaphore.html">00174</a> <span class="keyword">class </span><a class="code" href="classPSemaphore.html">PSemaphore</a> : <span class="keyword">public</span> <a class="code" href="classPObject.html">PObject</a>00175 {00176 <a class="code" href="object_8h.html#a27">PCLASSINFO</a>(<a class="code" href="classPSemaphore.html">PSemaphore</a>, <a class="code" href="classPObject.html">PObject</a>);00177 00178 <span class="keyword">public</span>:00185 <a class="code" href="classPSemaphore.html#z345_0">PSemaphore</a>(00186 <span class="keywordtype">unsigned</span> initial, 00187 <span class="keywordtype">unsigned</span> maximum 00188 );00189 00192 <a class="code" href="classPSemaphore.html#z345_0">PSemaphore</a>(<span class="keyword">const</span> <a class="code" href="classPSemaphore.html">PSemaphore</a> &);00193 00197 <a class="code" href="classPSemaphore.html#z345_2">~PSemaphore</a>();00199 00205 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPSemaphore.html#z347_0">Wait</a>();00206 00213 <span class="keyword">virtual</span> BOOL <a class="code" href="classPSemaphore.html#z347_0">Wait</a>(00214 <span class="keyword">const</span> <a class="code" href="classPTimeInterval.html">PTimeInterval</a> & timeout <span class="comment">// Amount of time to wait for semaphore.</span>00215 );00216 00221 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPSemaphore.html#z347_2">Signal</a>();00222 00229 <span class="keyword">virtual</span> BOOL <a class="code" href="classPSemaphore.html#z347_3">WillBlock</a>() <span class="keyword">const</span>;00231 00232 <span class="keyword">private</span>:00233 <a class="code" href="classPSemaphore.html">PSemaphore</a> & operator=(<span class="keyword">const</span> <a class="code" href="classPSemaphore.html">PSemaphore</a> &) { <span class="keywordflow">return</span> *<span class="keyword">this</span>; }00234 00235 00236 <span class="comment">// Include platform dependent part of class</span>00237 <span class="preprocessor">#ifdef _WIN32</span>00238 <span class="preprocessor"></span><span class="preprocessor">#include "msos/ptlib/semaphor.h"</span>00239 <span class="preprocessor">#else</span>00240 <span class="preprocessor"></span><span class="preprocessor">#include "unix/ptlib/semaphor.h"</span>00241 <span class="preprocessor">#endif</span>00242 <span class="preprocessor"></span>};00243 00244 <span class="preprocessor">#endif</span>00245 <span class="preprocessor"></span>00246 <span class="comment">// End Of File ///////////////////////////////////////////////////////////////</span></pre></div><hr><address style="align: right;"><small>Generated on Wed Sep 29 22:44:12 2004 for PWLib by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.18 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -