blob: d09f338780a0f399b1ba242a69153f50163bb505 [file] [log] [blame]
<!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>oscl_scheduler_aobase.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> &nbsp; <a class="qindex" href="modules.html">Modules</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="annotated.html">Data Structures</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="functions.html">Data Fields</a> &nbsp; <a class="qindex" href="globals.html">Globals</a> &nbsp; </center>
<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
00015 <span class="preprocessor">#ifndef OSCL_SCHEDULER_AOBASE_H_INCLUDED</span>
00016 <span class="preprocessor"></span><span class="preprocessor">#define OSCL_SCHEDULER_AOBASE_H_INCLUDED</span>
00017 <span class="preprocessor"></span>
00018 <span class="preprocessor">#ifndef OSCL_SCHEDULER_TYPES_H_INCLUDED</span>
00019 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__scheduler__types_8h.html">oscl_scheduler_types.h</a>"</span>
00020 <span class="preprocessor">#endif</span>
00021 <span class="preprocessor"></span>
00022 <span class="preprocessor">#ifndef OSCL_NAMESTRING_H_INCLUDED</span>
00023 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__namestring_8h.html">oscl_namestring.h</a>"</span>
00024 <span class="preprocessor">#endif</span>
00025 <span class="preprocessor"></span>
00026 <span class="preprocessor">#ifndef OSCL_SCHEDULER_THREAD_CONTEXT_H_INCLUDED</span>
00027 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__scheduler__threadcontext_8h.html">oscl_scheduler_threadcontext.h</a>"</span>
00028 <span class="preprocessor">#endif</span>
00029 <span class="preprocessor"></span>
00030 <span class="preprocessor">#ifndef OSCL_SCHEDULER_READYQ_H_INCLUDED</span>
00031 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__scheduler__readyq_8h.html">oscl_scheduler_readyq.h</a>"</span>
00032 <span class="preprocessor">#endif</span>
00033 <span class="preprocessor"></span>
00034 <span class="preprocessor">#ifndef OSCL_STRING_CONTAINERS_H_INCLUDED</span>
00035 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__string__containers_8h.html">oscl_string_containers.h</a>"</span>
00036 <span class="preprocessor">#endif</span>
00037 <span class="preprocessor"></span>
00038 <span class="comment">/*</span>
00039 <span class="comment"> * Macro for zeroizing the memory of a newly created object</span>
00040 <span class="comment"> *</span>
00041 <span class="comment"> * @param ptr pointer to the newly created object</span>
00042 <span class="comment"> *</span>
00043 <span class="comment"> * @param size size of the memory</span>
00044 <span class="comment"> */</span>
00045
<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>
00047 <span class="preprocessor"></span>
00048 <span class="comment">/*</span>
00049 <span class="comment">** Max length for scheduler and AO names.</span>
00050 <span class="comment">*/</span>
<a name="l00051"></a><a class="code" href="group__osclproc.html#a11">00051</a> <span class="preprocessor">#define PVEXECNAMELEN 30</span>
00052 <span class="preprocessor"></span>
00053 <span class="preprocessor">#if (PV_SCHED_ENABLE_AO_STATS)</span>
00054 <span class="preprocessor"></span>
<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>
00057 {
00058 <span class="keyword">private</span>:
00059 <span class="comment">//should be constructed only when AO is added to scheduler.</span>
00060 <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);
00061 ~<a class="code" href="classPVActiveStats.html">PVActiveStats</a>();
00062
00063 <span class="keywordtype">void</span> Combine(<a class="code" href="classPVActiveStats.html">PVActiveStats</a>&amp;);
00064
00065 <span class="comment">//Queue link for scheduler iPVStatQ</span>
00066 <a class="code" href="classOsclDoubleLink.html">OsclDoubleLink</a> iPVStatQLink;
00067
00068 <span class="comment">//this AO's scheduler</span>
00069 <a class="code" href="classOsclExecSchedulerCommonBase.html">OsclExecSchedulerCommonBase</a>* iScheduler;
00070 <span class="comment">//AO name</span>
00071 <a class="code" href="classOSCL__HeapString.html">OSCL_HeapString&lt;OsclMemAllocator&gt;</a> iAOName;
00072 <span class="comment">//pointer to original container object.</span>
00073 <a class="code" href="classPVActiveBase.html">PVActiveBase</a>* iPVActiveBase;
00074
00075 uint32 iNumRun;<span class="comment">//how many Run calls</span>
00076 uint32 iNumRunError;<span class="comment">//how many RunError calls</span>
00077 int32 iMaxTicksInRun;<span class="comment">//max time in any one Run call</span>
00078
00079 uint32 iTotalTicksInRun;
00080
00081 <span class="keywordtype">bool</span> i64Valid;<span class="comment">//use 64-bit stats instead of 32-bit</span>
00082 <a class="code" href="group__osclbase.html#a30">int64</a> i64TotalTicksInRun;<span class="comment">//avg number of clock ticks per Run</span>
00083
00084 <span class="comment">//for internal computation-- percent of total time in this Run</span>
00085 <span class="keywordtype">float</span> iPercent;
00086
00087 int32 iLeave;<span class="comment">//last leave code from a Run call</span>
00088 uint32 iNumCancel;<span class="comment">//how many DoCancel calls.</span>
00089
00090 uint32 iNumInstances;<span class="comment">//number of scheduler instances of this AO.</span>
00091 int32 iPriority;<span class="comment">//scheduler priority</span>
00092
<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>;
<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>;
<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>;
<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>;
<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>;
<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>;
00099 };
00100 <span class="preprocessor">#endif //(PV_SCHED_ENABLE_AO_STATS)</span>
00101 <span class="preprocessor"></span>
00102
<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>
00111 {
00112 <span class="keyword">public</span>:
<a name="l00113"></a><a class="code" href="classPVActiveBase.html#m0">00113</a> uint32 <a class="code" href="classPVActiveBase.html#m0">iAddedNum</a>;
00114
00115 <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>
00116 <span class="comment">//protected:</span>
00117
00118 <a class="code" href="classPVActiveBase.html#a0">PVActiveBase</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> name[], int32 pri);
00119
00120 <span class="keyword">virtual</span> <a class="code" href="classPVActiveBase.html#a1">~PVActiveBase</a>();
00121
00122 <span class="comment">/*</span>
00123 <span class="comment"> ** Each AO has a name, to aid in statistics reporting and debugging.</span>
00124 <span class="comment"> */</span>
<a name="l00125"></a><a class="code" href="classPVActiveBase.html#m1">00125</a> <a class="code" href="classOsclNameString.html">OsclNameString&lt;PVEXECNAMELEN&gt;</a> <a class="code" href="classPVActiveBase.html#m1">iName</a>;
00126
00127 <span class="comment">/*</span>
00128 <span class="comment"> ** Each AO knows its thread context, including a pointer to the scheduler</span>
00129 <span class="comment"> ** that it is in.</span>
00130 <span class="comment"> */</span>
<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>;
00132
00133 <span class="preprocessor">#if (PV_SCHED_ENABLE_AO_STATS)</span>
00134 <span class="preprocessor"></span> <span class="comment">/*</span>
00135 <span class="comment"> ** AO statistics</span>
00136 <span class="comment"> */</span>
<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>;
<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>;
00139 <span class="preprocessor">#endif</span>
00140 <span class="preprocessor"></span>
00141
00142 <span class="comment">/*</span>
00143 <span class="comment"> ** Non-Symbian AO implementation.</span>
00144 <span class="comment"> */</span>
00145
00146 <span class="comment">/*</span>
00147 <span class="comment"> ** Queue link for scheduler iExecTimerQ or iReadyQ.</span>
00148 <span class="comment"> */</span>
<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>;
00150
00151 <span class="comment">/*</span>
00152 <span class="comment"> ** Return true if this AO is in any queue.</span>
00153 <span class="comment"> */</span>
<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>()
00155 {
00156 <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>);
00157 }
00158
00159 <span class="comment">/*</span>
00160 <span class="comment"> ** The executing flag is set whenever a request is active (pending</span>
00161 <span class="comment"> ** or complete). The AO is de-activated by scheduler just before</span>
00162 <span class="comment"> ** calling the Run.</span>
00163 <span class="comment"> */</span>
<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>;
00165
<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>;
00185
00193 <span class="keyword">virtual</span> int32 <a class="code" href="classPVActiveBase.html#a3">RunError</a>(int32 aError) = 0;
00194
00221 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPVActiveBase.html#a4">Run</a>() = 0;
00222
00234 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPVActiveBase.html#a5">DoCancel</a>() = 0;
00235
00236 <span class="comment">/*</span>
00237 <span class="comment"> ** Common methods to support OsclActiveObject and OsclTimerObject APIs</span>
00238 <span class="comment"> */</span>
00239 <span class="keywordtype">void</span> <a class="code" href="classPVActiveBase.html#a6">AddToScheduler</a>();
00240 <span class="keywordtype">void</span> <a class="code" href="classPVActiveBase.html#a7">RemoveFromScheduler</a>();
00241 <span class="keywordtype">void</span> <a class="code" href="classPVActiveBase.html#a8">Destroy</a>();
00242 <span class="keywordtype">void</span> <a class="code" href="classPVActiveBase.html#a9">Activate</a>();
00243 OSCL_IMPORT_REF <span class="keywordtype">bool</span> <a class="code" href="classPVActiveBase.html#a10">IsAdded</a>()<span class="keyword">const</span>;
00244 <span class="keywordtype">void</span> <a class="code" href="classPVActiveBase.html#a11">Cancel</a>();
00245
<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>;
<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>;
<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>;
<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>;
<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>;
<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>;
<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>;
00253
00254 };
00255
00256 <span class="preprocessor">#endif</span>
00257 <span class="preprocessor"></span>
00258
00259
00260
</pre></div><hr size="1"><img src="pvlogo_small.jpg"><address style="align: right;"><small>OSCL API</small>
<address style="align: left;"><small>Posting Version: OPENCORE_20090310 </small>
</small></address>
</body>
</html>