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

📄 pprocess_8h-source.html

📁 pwlib开发文档
💻 HTML
📖 第 1 页 / 共 3 页
字号:
00182 <span class="comment"> * Moved destructor to platform dependent code.</span>00183 <span class="comment"> *</span>00184 <span class="comment"> * Revision 1.20  1996/02/25 11:15:26  robertj</span>00185 <span class="comment"> * Added platform dependent Construct function to PProcess.</span>00186 <span class="comment"> *</span>00187 <span class="comment"> * Revision 1.19  1996/02/03 11:54:09  robertj</span>00188 <span class="comment"> * Added operating system identification functions.</span>00189 <span class="comment"> *</span>00190 <span class="comment"> * Revision 1.18  1996/01/02 11:57:17  robertj</span>00191 <span class="comment"> * Added thread for timers.</span>00192 <span class="comment"> *</span>00193 <span class="comment"> * Revision 1.17  1995/12/23 03:46:02  robertj</span>00194 <span class="comment"> * Changed version numbers.</span>00195 <span class="comment"> *</span>00196 <span class="comment"> * Revision 1.16  1995/12/10 11:33:36  robertj</span>00197 <span class="comment"> * Added extra user information to processes and applications.</span>00198 <span class="comment"> * Changes to main() startup mechanism to support Mac.</span>00199 <span class="comment"> *</span>00200 <span class="comment"> * Revision 1.15  1995/06/17 11:13:05  robertj</span>00201 <span class="comment"> * Documentation update.</span>00202 <span class="comment"> *</span>00203 <span class="comment"> * Revision 1.14  1995/06/17 00:43:10  robertj</span>00204 <span class="comment"> * Made PreInitialise virtual for NT service support</span>00205 <span class="comment"> *</span>00206 <span class="comment"> * Revision 1.13  1995/03/14 12:42:14  robertj</span>00207 <span class="comment"> * Updated documentation to use HTML codes.</span>00208 <span class="comment"> *</span>00209 <span class="comment"> * Revision 1.12  1995/03/12  04:43:26  robertj</span>00210 <span class="comment"> * Remvoed redundent destructor.</span>00211 <span class="comment"> *</span>00212 <span class="comment"> * Revision 1.11  1995/01/11  09:45:09  robertj</span>00213 <span class="comment"> * Documentation and normalisation.</span>00214 <span class="comment"> *</span>00215 <span class="comment"> * Revision 1.10  1994/08/23  11:32:52  robertj</span>00216 <span class="comment"> * Oops</span>00217 <span class="comment"> *</span>00218 <span class="comment"> * Revision 1.9  1994/08/22  00:46:48  robertj</span>00219 <span class="comment"> * Added pragma fro GNU C++ compiler.</span>00220 <span class="comment"> *</span>00221 <span class="comment"> * Revision 1.8  1994/08/21  23:43:02  robertj</span>00222 <span class="comment"> * Added function to get the user name of the owner of a process.</span>00223 <span class="comment"> *</span>00224 <span class="comment"> * Revision 1.7  1994/08/04  11:51:04  robertj</span>00225 <span class="comment"> * Moved OperatingSystemYield() to protected for Unix.</span>00226 <span class="comment"> *</span>00227 <span class="comment"> * Revision 1.6  1994/08/01  03:42:23  robertj</span>00228 <span class="comment"> * Destructor needed for heap debugging.</span>00229 <span class="comment"> *</span>00230 <span class="comment"> * Revision 1.5  1994/07/27  05:58:07  robertj</span>00231 <span class="comment"> * Synchronisation.</span>00232 <span class="comment"> *</span>00233 <span class="comment"> * Revision 1.4  1994/07/21  12:33:49  robertj</span>00234 <span class="comment"> * Moved cooperative threads to common.</span>00235 <span class="comment"> *</span>00236 <span class="comment"> * Revision 1.3  1994/06/25  11:55:15  robertj</span>00237 <span class="comment"> * Unix version synchronisation.</span>00238 <span class="comment"> *</span>00239 <span class="comment"> */</span>00240 00241 <span class="preprocessor">#ifndef _PPROCESS</span>00242 <span class="preprocessor"></span><span class="preprocessor">#define _PPROCESS</span>00243 <span class="preprocessor"></span>00244 <span class="preprocessor">#ifdef P_USE_PRAGMA</span>00245 <span class="preprocessor"></span><span class="preprocessor">#pragma interface</span>00246 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00247 <span class="preprocessor"></span>00248 <span class="preprocessor">#include &lt;<a class="code" href="mutex_8h.html">ptlib/mutex.h</a>&gt;</span>00249 <span class="preprocessor">#include &lt;<a class="code" href="syncpoint_8h.html">ptlib/syncpoint.h</a>&gt;</span>00250 <span class="preprocessor">#include &lt;<a class="code" href="pfactory_8h.html">ptlib/pfactory.h</a>&gt;</span>00251 00252 00259 <span class="preprocessor">#ifdef P_VXWORKS</span>00260 <span class="preprocessor"></span><span class="preprocessor">#define PCREATE_PROCESS(cls) \</span>00261 <span class="preprocessor">  PProcess::PreInitialise(0, NULL, NULL); \</span>00262 <span class="preprocessor">  cls instance; \</span>00263 <span class="preprocessor">  instance._main();</span>00264 <span class="preprocessor"></span><span class="preprocessor">#elif defined(P_RTEMS)</span>00265 <span class="preprocessor"></span><span class="preprocessor">#define PCREATE_PROCESS(cls) \</span>00266 <span class="preprocessor">extern "C" {\</span>00267 <span class="preprocessor">   void* POSIX_Init( void* argument) \</span>00268 <span class="preprocessor">     { PProcess::PreInitialise(0, 0, 0); \</span>00269 <span class="preprocessor">       static cls instance; \</span>00270 <span class="preprocessor">       exit( instance._main() ); \</span>00271 <span class="preprocessor">     } \</span>00272 <span class="preprocessor">}</span>00273 <span class="preprocessor"></span><span class="preprocessor">#else</span><a name="l00274"></a><a class="code" href="pprocess_8h.html#a0">00274</a> <span class="preprocessor"></span><span class="preprocessor">#define PCREATE_PROCESS(cls) \</span>00275 <span class="preprocessor">  int main(int argc, char ** argv, char ** envp) \</span>00276 <span class="preprocessor">    { PProcess::PreInitialise(argc, argv, envp); \</span>00277 <span class="preprocessor">      static cls instance; \</span>00278 <span class="preprocessor">      return instance._main(); \</span>00279 <span class="preprocessor">    }</span>00280 <span class="preprocessor"></span><span class="preprocessor">#endif // P_VXWORKS</span>00281 <span class="preprocessor"></span>00282 <span class="comment">/*$MACRO PDECLARE_PROCESS(cls,ancestor,manuf,name,major,minor,status,build)</span>00283 <span class="comment">   This macro is used to declare the components necessary for a user PWLib</span>00284 <span class="comment">   process. This will declare the PProcess descendent class, eg PApplication,</span>00285 <span class="comment">   and create an instance of the class. See the #PCREATE_PROCESS# macro</span>00286 <span class="comment">   for more details.</span>00287 <span class="comment"> */</span><a name="l00288"></a><a class="code" href="pprocess_8h.html#a1">00288</a> <span class="preprocessor">#define PDECLARE_PROCESS(cls,ancestor,manuf,name,major,minor,status,build) \</span>00289 <span class="preprocessor">  class cls : public ancestor { \</span>00290 <span class="preprocessor">    PCLASSINFO(cls, ancestor); \</span>00291 <span class="preprocessor">    public: \</span>00292 <span class="preprocessor">      cls() : ancestor(manuf, name, major, minor, status, build) { } \</span>00293 <span class="preprocessor">    private: \</span>00294 <span class="preprocessor">      virtual void Main(); \</span>00295 <span class="preprocessor">  };</span>00296 <span class="preprocessor"></span>00297 00298 <a class="code" href="lists_8h.html#a0">PLIST</a>(PInternalTimerList, <a class="code" href="classPTimer.html">PTimer</a>);00299 <a name="l00300"></a><a class="code" href="classPTimerList.html">00300</a> <span class="keyword">class </span><a class="code" href="classPTimerList.html">PTimerList</a> : PInternalTimerList <span class="comment">// Want this to be private</span>00301 <span class="comment">/* This class defines a list of #PTimer# objects. It is primarily used</span>00302 <span class="comment">   internally by the library and the user should never create an instance of</span>00303 <span class="comment">   it. The #PProcess# instance for the application maintains an instance</span>00304 <span class="comment">   of all of the timers created so that it may decrements them at regular</span>00305 <span class="comment">   intervals.</span>00306 <span class="comment"> */</span>00307 {00308   <a class="code" href="object_8h.html#a27">PCLASSINFO</a>(<a class="code" href="classPTimerList.html">PTimerList</a>, PInternalTimerList);00309 00310   <span class="keyword">public</span>:00311     <a class="code" href="classPTimerList.html#a0">PTimerList</a>();00312     <span class="comment">// Create a new timer list</span>00313 00314     <a class="code" href="classPTimeInterval.html">PTimeInterval</a> <a class="code" href="classPTimerList.html#a1">Process</a>();00315     <span class="comment">/* Decrement all the created timers and dispatch to their callback</span>00316 <span class="comment">       functions if they have expired. The #PTimer::Tick()# function</span>00317 <span class="comment">       value is used to determine the time elapsed since the last call to</span>00318 <span class="comment">       Process().</span>00319 <span class="comment"></span>00320 <span class="comment">       The return value is the number of milliseconds until the next timer</span>00321 <span class="comment">       needs to be despatched. The function need not be called again for this</span>00322 <span class="comment">       amount of time, though it can (and usually is).</span>00323 <span class="comment">       </span>00324 <span class="comment">       @return</span>00325 <span class="comment">       maximum time interval before function should be called again.</span>00326 <span class="comment">     */</span>00327 00328   <span class="keyword">private</span>:00329     <a class="code" href="classPMutex.html">PMutex</a> listMutex, processingMutex, inTimeoutMutex;00330     <span class="comment">// Mutual exclusion for multi tasking</span>00331 00332     <a class="code" href="classPTimeInterval.html">PTimeInterval</a> lastSample;00333     <span class="comment">// The last system timer tick value that was used to process timers.</span>00334 00335     <a class="code" href="classPTimer.html">PTimer</a> * currentTimer;00336     <span class="comment">// The timer which is currently being handled</span>00337 <a name="l00338"></a><a class="code" href="classPTimerList.html#l0">00338</a>   <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classPTimer.html">PTimer</a>;00339 };00340 00341 00343 <span class="comment">// PProcess</span>00344 <a name="l00357"></a><a class="code" href="classPProcess.html">00357</a> <span class="keyword">class </span><a class="code" href="classPProcess.html">PProcess</a> : <span class="keyword">public</span> <a class="code" href="classPThread.html">PThread</a>00358 {00359   <a class="code" href="object_8h.html#a27">PCLASSINFO</a>(<a class="code" href="classPProcess.html">PProcess</a>, <a class="code" href="classPThread.html">PThread</a>);00360 00361   <span class="keyword">public</span>:00364 <a name="l00365"></a><a class="code" href="classPProcess.html#z221_0">00365</a>     <span class="keyword">enum</span> <a class="code" href="classPProcess.html#z221_0">CodeStatus</a> {00367       <a class="code" href="classPProcess.html#z221_0s0">AlphaCode</a>,    00369       <a class="code" href="classPProcess.html#z221_0s1">BetaCode</a>,     00371       <a class="code" href="classPProcess.html#z221_0s2">ReleaseCode</a>,  00372       <a class="code" href="classPProcess.html#z221_0s3">NumCodeStatuses</a>00373     };00374 00377     <a class="code" href="classPProcess.html#z221_1">PProcess</a>(00378       <span class="keyword">const</span> <span class="keywordtype">char</span> * manuf = <span class="stringliteral">""</span>,         00379       <span class="keyword">const</span> <span class="keywordtype">char</span> * name = <span class="stringliteral">""</span>,          00380       WORD majorVersion = 1,           00381       WORD minorVersion = 0,           00382       <a class="code" href="classPProcess.html#z221_0">CodeStatus</a> status = <a class="code" href="classPProcess.html#z221_0s2">ReleaseCode</a>, 00383       WORD buildNumber = 1             00384     );00386 00395     <a class="code" href="classPObject.html#z199_0">Comparison</a> <a class="code" href="classPProcess.html#z223_0">Compare</a>(00396       <span class="keyword">const</span> <a class="code" href="classPObject.html">PObject</a> &amp; obj   00397     ) <span class="keyword">const</span>;00399 00404     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPProcess.html#z225_0">Terminate</a>();00405 00411     <span class="keyword">virtual</span> <a class="code" href="classPString.html">PString</a> <a class="code" href="classPProcess.html#z225_1">GetThreadName</a>() <span class="keyword">const</span>;00412 00418     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPProcess.html#z225_2">SetThreadName</a>(00419       <span class="keyword">const</span> <a class="code" href="classPString.html">PString</a> &amp; name        00420     );

⌨️ 快捷键说明

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