1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 2<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> 3<title>oscl_scheduler_aobase.h Source File</title> 4<link href="doxygen.css" rel="stylesheet" type="text/css"> 5</head><body> 6<!-- Generated by Doxygen 1.2.18 --> 7<center> 8<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="modules.html">Modules</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Data Structures</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Data Fields</a> <a class="qindex" href="globals.html">Globals</a> </center> 9<hr><h1>oscl_scheduler_aobase.h</h1><a href="oscl__scheduler__aobase_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 1000015 <span class="preprocessor">#ifndef OSCL_SCHEDULER_AOBASE_H_INCLUDED</span> 1100016 <span class="preprocessor"></span><span class="preprocessor">#define OSCL_SCHEDULER_AOBASE_H_INCLUDED</span> 1200017 <span class="preprocessor"></span> 1300018 <span class="preprocessor">#ifndef OSCL_SCHEDULER_TYPES_H_INCLUDED</span> 1400019 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__scheduler__types_8h.html">oscl_scheduler_types.h</a>"</span> 1500020 <span class="preprocessor">#endif</span> 1600021 <span class="preprocessor"></span> 1700022 <span class="preprocessor">#ifndef OSCL_NAMESTRING_H_INCLUDED</span> 1800023 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__namestring_8h.html">oscl_namestring.h</a>"</span> 1900024 <span class="preprocessor">#endif</span> 2000025 <span class="preprocessor"></span> 2100026 <span class="preprocessor">#ifndef OSCL_SCHEDULER_THREAD_CONTEXT_H_INCLUDED</span> 2200027 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__scheduler__threadcontext_8h.html">oscl_scheduler_threadcontext.h</a>"</span> 2300028 <span class="preprocessor">#endif</span> 2400029 <span class="preprocessor"></span> 2500030 <span class="preprocessor">#ifndef OSCL_SCHEDULER_READYQ_H_INCLUDED</span> 2600031 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__scheduler__readyq_8h.html">oscl_scheduler_readyq.h</a>"</span> 2700032 <span class="preprocessor">#endif</span> 2800033 <span class="preprocessor"></span> 2900034 <span class="preprocessor">#ifndef OSCL_STRING_CONTAINERS_H_INCLUDED</span> 3000035 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__string__containers_8h.html">oscl_string_containers.h</a>"</span> 3100036 <span class="preprocessor">#endif</span> 3200037 <span class="preprocessor"></span> 3300038 <span class="comment">/*</span> 3400039 <span class="comment"> * Macro for zeroizing the memory of a newly created object</span> 3500040 <span class="comment"> *</span> 3600041 <span class="comment"> * @param ptr pointer to the newly created object</span> 3700042 <span class="comment"> *</span> 3800043 <span class="comment"> * @param size size of the memory</span> 3900044 <span class="comment"> */</span> 4000045 41<a name="l00046"></a><a class="code" href="group__osclproc.html#a10">00046</a> <span class="preprocessor">#define OSCL_ZEROIZE(ptr, size) oscl_memset(ptr, 0, size)</span> 4200047 <span class="preprocessor"></span> 4300048 <span class="comment">/*</span> 4400049 <span class="comment">** Max length for scheduler and AO names.</span> 4500050 <span class="comment">*/</span> 46<a name="l00051"></a><a class="code" href="group__osclproc.html#a11">00051</a> <span class="preprocessor">#define PVEXECNAMELEN 30</span> 4700052 <span class="preprocessor"></span> 4800053 <span class="preprocessor">#if (PV_SCHED_ENABLE_AO_STATS)</span> 4900054 <span class="preprocessor"></span> 50<a name="l00056"></a><a class="code" href="classPVActiveStats.html">00056</a> <span class="keyword">class </span><a class="code" href="classPVActiveStats.html">PVActiveStats</a> 5100057 { 5200058 <span class="keyword">private</span>: 5300059 <span class="comment">//should be constructed only when AO is added to scheduler.</span> 5400060 <a class="code" href="classPVActiveStats.html">PVActiveStats</a>(<a class="code" href="classOsclExecSchedulerCommonBase.html">OsclExecSchedulerCommonBase</a>* aScheduler, <span class="keyword">const</span> <span class="keywordtype">char</span>* aAOName, <a class="code" href="classPVActiveBase.html">PVActiveBase</a>* aActiveBase); 5500061 ~<a class="code" href="classPVActiveStats.html">PVActiveStats</a>(); 5600062 5700063 <span class="keywordtype">void</span> Combine(<a class="code" href="classPVActiveStats.html">PVActiveStats</a>&); 5800064 5900065 <span class="comment">//Queue link for scheduler iPVStatQ</span> 6000066 <a class="code" href="classOsclDoubleLink.html">OsclDoubleLink</a> iPVStatQLink; 6100067 6200068 <span class="comment">//this AO's scheduler</span> 6300069 <a class="code" href="classOsclExecSchedulerCommonBase.html">OsclExecSchedulerCommonBase</a>* iScheduler; 6400070 <span class="comment">//AO name</span> 6500071 <a class="code" href="classOSCL__HeapString.html">OSCL_HeapString<OsclMemAllocator></a> iAOName; 6600072 <span class="comment">//pointer to original container object.</span> 6700073 <a class="code" href="classPVActiveBase.html">PVActiveBase</a>* iPVActiveBase; 6800074 6900075 uint32 iNumRun;<span class="comment">//how many Run calls</span> 7000076 uint32 iNumRunError;<span class="comment">//how many RunError calls</span> 7100077 int32 iMaxTicksInRun;<span class="comment">//max time in any one Run call</span> 7200078 7300079 uint32 iTotalTicksInRun; 7400080 7500081 <span class="keywordtype">bool</span> i64Valid;<span class="comment">//use 64-bit stats instead of 32-bit</span> 7600082 <a class="code" href="group__osclbase.html#a30">int64</a> i64TotalTicksInRun;<span class="comment">//avg number of clock ticks per Run</span> 7700083 7800084 <span class="comment">//for internal computation-- percent of total time in this Run</span> 7900085 <span class="keywordtype">float</span> iPercent; 8000086 8100087 int32 iLeave;<span class="comment">//last leave code from a Run call</span> 8200088 uint32 iNumCancel;<span class="comment">//how many DoCancel calls.</span> 8300089 8400090 uint32 iNumInstances;<span class="comment">//number of scheduler instances of this AO.</span> 8500091 int32 iPriority;<span class="comment">//scheduler priority</span> 8600092 87<a name="l00093"></a><a class="code" href="classPVActiveStats.html#l0">00093</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classPVActiveBase.html">PVActiveBase</a>; 88<a name="l00094"></a><a class="code" href="classPVActiveStats.html#l1">00094</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classOsclExecScheduler.html">OsclExecScheduler</a>; 89<a name="l00095"></a><a class="code" href="classPVActiveStats.html#l2">00095</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classOsclExecSchedulerCommonBase.html">OsclExecSchedulerCommonBase</a>; 90<a name="l00096"></a><a class="code" href="classPVActiveStats.html#l3">00096</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classOsclActiveObject.html">OsclActiveObject</a>; 91<a name="l00097"></a><a class="code" href="classPVActiveStats.html#l4">00097</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classOsclTimerObject.html">OsclTimerObject</a>; 92<a name="l00098"></a><a class="code" href="classPVActiveStats.html#l5">00098</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classOsclReadyQ.html">OsclReadyQ</a>; 9300099 }; 9400100 <span class="preprocessor">#endif //(PV_SCHED_ENABLE_AO_STATS)</span> 9500101 <span class="preprocessor"></span> 9600102 97<a name="l00110"></a><a class="code" href="classPVActiveBase.html">00110</a> <span class="keyword">class </span><a class="code" href="classPVActiveBase.html">PVActiveBase</a> 9800111 { 9900112 <span class="keyword">public</span>: 100<a name="l00113"></a><a class="code" href="classPVActiveBase.html#m0">00113</a> uint32 <a class="code" href="classPVActiveBase.html#m0">iAddedNum</a>; 10100114 10200115 <span class="comment">//iStatus, AddToScheduler(), RemoveFromScheduler etc are needed in PVSchedulerStopper (which is publically derived from OsclActiveObject and OsclActiveObject is publically derived from PVActiveBase )</span> 10300116 <span class="comment">//protected:</span> 10400117 10500118 <a class="code" href="classPVActiveBase.html#a0">PVActiveBase</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> name[], int32 pri); 10600119 10700120 <span class="keyword">virtual</span> <a class="code" href="classPVActiveBase.html#a1">~PVActiveBase</a>(); 10800121 10900122 <span class="comment">/*</span> 11000123 <span class="comment"> ** Each AO has a name, to aid in statistics reporting and debugging.</span> 11100124 <span class="comment"> */</span> 112<a name="l00125"></a><a class="code" href="classPVActiveBase.html#m1">00125</a> <a class="code" href="classOsclNameString.html">OsclNameString<PVEXECNAMELEN></a> <a class="code" href="classPVActiveBase.html#m1">iName</a>; 11300126 11400127 <span class="comment">/*</span> 11500128 <span class="comment"> ** Each AO knows its thread context, including a pointer to the scheduler</span> 11600129 <span class="comment"> ** that it is in.</span> 11700130 <span class="comment"> */</span> 118<a name="l00131"></a><a class="code" href="classPVActiveBase.html#m2">00131</a> <a class="code" href="classPVThreadContext.html">PVThreadContext</a> <a class="code" href="classPVActiveBase.html#m2">iThreadContext</a>; 11900132 12000133 <span class="preprocessor">#if (PV_SCHED_ENABLE_AO_STATS)</span> 12100134 <span class="preprocessor"></span> <span class="comment">/*</span> 12200135 <span class="comment"> ** AO statistics</span> 12300136 <span class="comment"> */</span> 124<a name="l00137"></a><a class="code" href="classPVActiveBase.html#m3">00137</a> <a class="code" href="classPVActiveStats.html">PVActiveStats</a> *<a class="code" href="classPVActiveBase.html#m3">iPVActiveStats</a>; 125<a name="l00138"></a><a class="code" href="classPVActiveBase.html#l0">00138</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classPVActiveStats.html">PVActiveStats</a>; 12600139 <span class="preprocessor">#endif</span> 12700140 <span class="preprocessor"></span> 12800141 12900142 <span class="comment">/*</span> 13000143 <span class="comment"> ** Non-Symbian AO implementation.</span> 13100144 <span class="comment"> */</span> 13200145 13300146 <span class="comment">/*</span> 13400147 <span class="comment"> ** Queue link for scheduler iExecTimerQ or iReadyQ.</span> 13500148 <span class="comment"> */</span> 136<a name="l00149"></a><a class="code" href="classPVActiveBase.html#m4">00149</a> <a class="code" href="classTReadyQueLink.html">TReadyQueLink</a> <a class="code" href="classPVActiveBase.html#m4">iPVReadyQLink</a>; 13700150 13800151 <span class="comment">/*</span> 13900152 <span class="comment"> ** Return true if this AO is in any queue.</span> 14000153 <span class="comment"> */</span> 141<a name="l00154"></a><a class="code" href="classPVActiveBase.html#a2">00154</a> <span class="keywordtype">bool</span> <a class="code" href="classPVActiveBase.html#a2">IsInAnyQ</a>() 14200155 { 14300156 <span class="keywordflow">return</span>(iPVReadyQLink.<a class="code" href="classTReadyQueLink.html#m4">iIsIn</a> != <a class="code" href="group__osclbase.html#a81">NULL</a>); 14400157 } 14500158 14600159 <span class="comment">/*</span> 14700160 <span class="comment"> ** The executing flag is set whenever a request is active (pending</span> 14800161 <span class="comment"> ** or complete). The AO is de-activated by scheduler just before</span> 14900162 <span class="comment"> ** calling the Run.</span> 15000163 <span class="comment"> */</span> 151<a name="l00164"></a><a class="code" href="classPVActiveBase.html#m5">00164</a> <span class="keywordtype">bool</span> <a class="code" href="classPVActiveBase.html#m5">iBusy</a>; 15200165 153<a name="l00184"></a><a class="code" href="classPVActiveBase.html#m6">00184</a> <a class="code" href="classOsclAOStatus.html">OsclAOStatus</a> <a class="code" href="classPVActiveBase.html#m6">iStatus</a>; 15400185 15500193 <span class="keyword">virtual</span> int32 <a class="code" href="classPVActiveBase.html#a3">RunError</a>(int32 aError) = 0; 15600194 15700221 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPVActiveBase.html#a4">Run</a>() = 0; 15800222 15900234 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPVActiveBase.html#a5">DoCancel</a>() = 0; 16000235 16100236 <span class="comment">/*</span> 16200237 <span class="comment"> ** Common methods to support OsclActiveObject and OsclTimerObject APIs</span> 16300238 <span class="comment"> */</span> 16400239 <span class="keywordtype">void</span> <a class="code" href="classPVActiveBase.html#a6">AddToScheduler</a>(); 16500240 <span class="keywordtype">void</span> <a class="code" href="classPVActiveBase.html#a7">RemoveFromScheduler</a>(); 16600241 <span class="keywordtype">void</span> <a class="code" href="classPVActiveBase.html#a8">Destroy</a>(); 16700242 <span class="keywordtype">void</span> <a class="code" href="classPVActiveBase.html#a9">Activate</a>(); 16800243 OSCL_IMPORT_REF <span class="keywordtype">bool</span> <a class="code" href="classPVActiveBase.html#a10">IsAdded</a>()<span class="keyword">const</span>; 16900244 <span class="keywordtype">void</span> <a class="code" href="classPVActiveBase.html#a11">Cancel</a>(); 17000245 171<a name="l00246"></a><a class="code" href="classPVActiveBase.html#l1">00246</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classPVActiveBase.html#l1">OsclSchedulerCommonBase</a>; 172<a name="l00247"></a><a class="code" href="classPVActiveBase.html#l2">00247</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classOsclActiveObject.html">OsclActiveObject</a>; 173<a name="l00248"></a><a class="code" href="classPVActiveBase.html#l3">00248</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classOsclTimerObject.html">OsclTimerObject</a>; 174<a name="l00249"></a><a class="code" href="classPVActiveBase.html#l4">00249</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classOsclReadyQ.html">OsclReadyQ</a>; 175<a name="l00250"></a><a class="code" href="classPVActiveBase.html#l5">00250</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classOsclReadyCompare.html">OsclReadyCompare</a>; 176<a name="l00251"></a><a class="code" href="classPVActiveBase.html#l6">00251</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classPVActiveBase.html#l6">OsclReadySetPosition</a>; 177<a name="l00252"></a><a class="code" href="classPVActiveBase.html#l7">00252</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classOsclExecScheduler.html">OsclExecScheduler</a>; 17800253 17900254 }; 18000255 18100256 <span class="preprocessor">#endif</span> 18200257 <span class="preprocessor"></span> 18300258 18400259 18500260 186</pre></div><hr size="1"><img src="pvlogo_small.jpg"><address style="align: right;"><small>OSCL API</small> 187<address style="align: left;"><small>Posting Version: OPENCORE_20090310 </small> 188</small></address> 189</body> 190</html> 191