aboutsummaryrefslogtreecommitdiff
path: root/doc/oscl_html/oscl__scheduler__aobase_8h_source.html
blob: 84cd30940f4c26fd8c693b7fa7673211aeb5f6f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>oscl: oscl_scheduler_aobase.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&nbsp;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
<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 class="fragment"><a name="l00001"></a>00001 
<a name="l00015"></a>00015 <span class="preprocessor">#ifndef OSCL_SCHEDULER_AOBASE_H_INCLUDED</span>
<a name="l00016"></a>00016 <span class="preprocessor"></span><span class="preprocessor">#define OSCL_SCHEDULER_AOBASE_H_INCLUDED</span>
<a name="l00017"></a>00017 <span class="preprocessor"></span>
<a name="l00018"></a>00018 <span class="preprocessor">#ifndef OSCL_SCHEDULER_TYPES_H_INCLUDED</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span><span class="preprocessor">#include &quot;<a class="code" href="oscl__scheduler__types_8h.html" title="Scheduler common types include file.">oscl_scheduler_types.h</a>&quot;</span>
<a name="l00020"></a>00020 <span class="preprocessor">#endif</span>
<a name="l00021"></a>00021 <span class="preprocessor"></span>
<a name="l00022"></a>00022 <span class="preprocessor">#ifndef OSCL_NAMESTRING_H_INCLUDED</span>
<a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#include &quot;<a class="code" href="oscl__namestring_8h.html" title="Name string class include file.">oscl_namestring.h</a>&quot;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#endif</span>
<a name="l00025"></a>00025 <span class="preprocessor"></span>
<a name="l00026"></a>00026 <span class="preprocessor">#ifndef OSCL_SCHEDULER_THREAD_CONTEXT_H_INCLUDED</span>
<a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#include &quot;<a class="code" href="oscl__scheduler__threadcontext_8h.html" title="Thread context functions needed by oscl scheduler.">oscl_scheduler_threadcontext.h</a>&quot;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#endif</span>
<a name="l00029"></a>00029 <span class="preprocessor"></span>
<a name="l00030"></a>00030 <span class="preprocessor">#ifndef OSCL_SCHEDULER_READYQ_H_INCLUDED</span>
<a name="l00031"></a>00031 <span class="preprocessor"></span><span class="preprocessor">#include &quot;<a class="code" href="oscl__scheduler__readyq_8h.html" title="ready q types for oscl scheduler">oscl_scheduler_readyq.h</a>&quot;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#endif</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span>
<a name="l00034"></a>00034 <span class="preprocessor">#ifndef OSCL_STRING_CONTAINERS_H_INCLUDED</span>
<a name="l00035"></a>00035 <span class="preprocessor"></span><span class="preprocessor">#include &quot;<a class="code" href="oscl__string__containers_8h.html" title="Provides a standardized set of string containers that can be used in place of character...">oscl_string_containers.h</a>&quot;</span>
<a name="l00036"></a>00036 <span class="preprocessor">#endif</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span>
<a name="l00038"></a>00038 <span class="comment">/*</span>
<a name="l00039"></a>00039 <span class="comment"> * Macro for zeroizing the memory of a newly created object</span>
<a name="l00040"></a>00040 <span class="comment"> *</span>
<a name="l00041"></a>00041 <span class="comment"> * @param ptr   pointer to the newly created object</span>
<a name="l00042"></a>00042 <span class="comment"> *</span>
<a name="l00043"></a>00043 <span class="comment"> * @param size  size of the memory</span>
<a name="l00044"></a>00044 <span class="comment"> */</span>
<a name="l00045"></a>00045 
<a name="l00046"></a><a class="code" href="group__osclproc.html#ga8c25001fcc61a527f8438977dd1e03fa">00046</a> <span class="preprocessor">#define OSCL_ZEROIZE(ptr, size) oscl_memset(ptr, 0, size)</span>
<a name="l00047"></a>00047 <span class="preprocessor"></span>
<a name="l00048"></a>00048 <span class="comment">/*</span>
<a name="l00049"></a>00049 <span class="comment">** Max length for scheduler and AO names.</span>
<a name="l00050"></a>00050 <span class="comment">*/</span>
<a name="l00051"></a><a class="code" href="group__osclproc.html#ga316083ea3a896b56e8f2b86baf589d25">00051</a> <span class="preprocessor">#define PVEXECNAMELEN 30</span>
<a name="l00052"></a>00052 <span class="preprocessor"></span>
<a name="l00053"></a>00053 <span class="preprocessor">#if (PV_SCHED_ENABLE_AO_STATS)</span>
<a name="l00054"></a>00054 <span class="preprocessor"></span>
<a name="l00056"></a>00056 <span class="keyword">class </span>PVActiveStats
<a name="l00057"></a>00057 {
<a name="l00058"></a>00058     <span class="keyword">private</span>:
<a name="l00059"></a>00059         <span class="comment">//should be constructed only when AO is added to scheduler.</span>
<a name="l00060"></a>00060         PVActiveStats(<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);
<a name="l00061"></a>00061         ~PVActiveStats();
<a name="l00062"></a>00062 
<a name="l00063"></a>00063         <span class="keywordtype">void</span> Combine(PVActiveStats&amp;);
<a name="l00064"></a>00064 
<a name="l00065"></a>00065         <span class="comment">//Queue link for scheduler iPVStatQ</span>
<a name="l00066"></a>00066         <a class="code" href="classOsclDoubleLink.html">OsclDoubleLink</a> iPVStatQLink;
<a name="l00067"></a>00067 
<a name="l00068"></a>00068         <span class="comment">//this AO&#39;s scheduler</span>
<a name="l00069"></a>00069         <a class="code" href="classOsclExecSchedulerCommonBase.html">OsclExecSchedulerCommonBase</a>* iScheduler;
<a name="l00070"></a>00070         <span class="comment">//AO name</span>
<a name="l00071"></a>00071         <a class="code" href="classOSCL__HeapString.html">OSCL_HeapString&lt;OsclMemAllocator&gt;</a> iAOName;
<a name="l00072"></a>00072         <span class="comment">//pointer to original container object.</span>
<a name="l00073"></a>00073         <a class="code" href="classPVActiveBase.html">PVActiveBase</a>* iPVActiveBase;
<a name="l00074"></a>00074 
<a name="l00075"></a>00075         uint32 iNumRun;<span class="comment">//how many Run calls</span>
<a name="l00076"></a>00076         uint32 iNumRunError;<span class="comment">//how many RunError calls</span>
<a name="l00077"></a>00077         int32 iMaxTicksInRun;<span class="comment">//max time in any one Run call</span>
<a name="l00078"></a>00078 
<a name="l00079"></a>00079         uint32 iTotalTicksInRun;
<a name="l00080"></a>00080 
<a name="l00081"></a>00081         <span class="keywordtype">bool</span> i64Valid;<span class="comment">//use 64-bit stats instead of 32-bit</span>
<a name="l00082"></a>00082         <a class="code" href="group__osclbase.html#gad3ba4095e745890683ed3aa53c47384d">int64</a> i64TotalTicksInRun;<span class="comment">//avg number of clock ticks per Run</span>
<a name="l00083"></a>00083 
<a name="l00084"></a>00084         <span class="comment">//for internal computation-- percent of total time in this Run</span>
<a name="l00085"></a>00085         <span class="keywordtype">float</span> iPercent;
<a name="l00086"></a>00086 
<a name="l00087"></a>00087         int32 iLeave;<span class="comment">//last leave code from a Run call</span>
<a name="l00088"></a>00088         uint32 iNumCancel;<span class="comment">//how many DoCancel calls.</span>
<a name="l00089"></a>00089 
<a name="l00090"></a>00090         uint32 iNumInstances;<span class="comment">//number of scheduler instances of this AO.</span>
<a name="l00091"></a>00091         int32 iPriority;<span class="comment">//scheduler priority</span>
<a name="l00092"></a>00092 
<a name="l00093"></a>00093         <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classPVActiveBase.html">PVActiveBase</a>;
<a name="l00094"></a>00094         <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classOsclExecScheduler.html">OsclExecScheduler</a>;
<a name="l00095"></a>00095         <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classOsclExecSchedulerCommonBase.html">OsclExecSchedulerCommonBase</a>;
<a name="l00096"></a>00096         <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classOsclActiveObject.html">OsclActiveObject</a>;
<a name="l00097"></a>00097         <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classOsclTimerObject.html">OsclTimerObject</a>;
<a name="l00098"></a>00098         <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classOsclReadyQ.html">OsclReadyQ</a>;
<a name="l00099"></a>00099 };
<a name="l00100"></a>00100 <span class="preprocessor">#endif //(PV_SCHED_ENABLE_AO_STATS)</span>
<a name="l00101"></a>00101 <span class="preprocessor"></span>
<a name="l00102"></a>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>
<a name="l00111"></a>00111 {
<a name="l00112"></a>00112     <span class="keyword">public</span>:
<a name="l00113"></a><a class="code" href="classPVActiveBase.html#ab12ed89c86d2dd40e59c5b41424e804d">00113</a>         uint32 <a class="code" href="classPVActiveBase.html#ab12ed89c86d2dd40e59c5b41424e804d">iAddedNum</a>;
<a name="l00114"></a>00114 
<a name="l00115"></a>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>
<a name="l00116"></a>00116 <span class="comment">//protected:</span>
<a name="l00117"></a>00117 
<a name="l00118"></a>00118         <a class="code" href="classPVActiveBase.html#a0f67f82018183b772e871a284fe0aca4">PVActiveBase</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> name[], int32 pri);
<a name="l00119"></a>00119 
<a name="l00120"></a>00120         <span class="keyword">virtual</span> <a class="code" href="classPVActiveBase.html#a8a136a1a0a380ea3cdd06a9e2fa3f3b6">~PVActiveBase</a>();
<a name="l00121"></a>00121 
<a name="l00122"></a>00122         <span class="comment">/*</span>
<a name="l00123"></a>00123 <span class="comment">        ** Each AO has a name, to aid in statistics reporting and debugging.</span>
<a name="l00124"></a>00124 <span class="comment">        */</span>
<a name="l00125"></a><a class="code" href="classPVActiveBase.html#ae6c71053cf027bd371d8d369ff708f95">00125</a>         <a class="code" href="classOsclNameString.html">OsclNameString&lt;PVEXECNAMELEN&gt;</a> <a class="code" href="classPVActiveBase.html#ae6c71053cf027bd371d8d369ff708f95">iName</a>;
<a name="l00126"></a>00126 
<a name="l00127"></a>00127         <span class="comment">/*</span>
<a name="l00128"></a>00128 <span class="comment">        ** Each AO knows its thread context, including a pointer to the scheduler</span>
<a name="l00129"></a>00129 <span class="comment">        ** that it is in.</span>
<a name="l00130"></a>00130 <span class="comment">        */</span>
<a name="l00131"></a><a class="code" href="classPVActiveBase.html#ab4158cbb39a8565ef6a0962203aa5ef4">00131</a>         <a class="code" href="classPVThreadContext.html">PVThreadContext</a> <a class="code" href="classPVActiveBase.html#ab4158cbb39a8565ef6a0962203aa5ef4">iThreadContext</a>;
<a name="l00132"></a>00132 
<a name="l00133"></a>00133 <span class="preprocessor">#if (PV_SCHED_ENABLE_AO_STATS)</span>
<a name="l00134"></a>00134 <span class="preprocessor"></span>        <span class="comment">/*</span>
<a name="l00135"></a>00135 <span class="comment">        ** AO statistics</span>
<a name="l00136"></a>00136 <span class="comment">        */</span>
<a name="l00137"></a>00137         PVActiveStats *iPVActiveStats;
<a name="l00138"></a>00138         <span class="keyword">friend</span> <span class="keyword">class </span>PVActiveStats;
<a name="l00139"></a>00139 <span class="preprocessor">#endif</span>
<a name="l00140"></a>00140 <span class="preprocessor"></span>
<a name="l00141"></a>00141 
<a name="l00142"></a>00142         <span class="comment">/*</span>
<a name="l00143"></a>00143 <span class="comment">        ** Non-Symbian AO implementation.</span>
<a name="l00144"></a>00144 <span class="comment">        */</span>
<a name="l00145"></a>00145 
<a name="l00146"></a>00146         <span class="comment">/*</span>
<a name="l00147"></a>00147 <span class="comment">        ** Queue link for scheduler iExecTimerQ or iReadyQ.</span>
<a name="l00148"></a>00148 <span class="comment">        */</span>
<a name="l00149"></a><a class="code" href="classPVActiveBase.html#a6be20b0c4b53659ff2e5da66c9850c3c">00149</a>         <a class="code" href="classTReadyQueLink.html">TReadyQueLink</a> <a class="code" href="classPVActiveBase.html#a6be20b0c4b53659ff2e5da66c9850c3c">iPVReadyQLink</a>;
<a name="l00150"></a>00150 
<a name="l00151"></a>00151         <span class="comment">/*</span>
<a name="l00152"></a>00152 <span class="comment">        ** Return true if this AO is in any queue.</span>
<a name="l00153"></a>00153 <span class="comment">        */</span>
<a name="l00154"></a><a class="code" href="classPVActiveBase.html#a38e5381814f978bda826181b111fcd5c">00154</a>         <span class="keywordtype">bool</span> <a class="code" href="classPVActiveBase.html#a38e5381814f978bda826181b111fcd5c">IsInAnyQ</a>()
<a name="l00155"></a>00155         {
<a name="l00156"></a>00156             <span class="keywordflow">return</span>(<a class="code" href="classPVActiveBase.html#a6be20b0c4b53659ff2e5da66c9850c3c">iPVReadyQLink</a>.<a class="code" href="classTReadyQueLink.html#ab3c2cbe5c56774b7bf4f0ccfcc876f8e">iIsIn</a> != <a class="code" href="group__osclbase.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="The NULL_TERM_CHAR is used to terminate c-style strings.">NULL</a>);
<a name="l00157"></a>00157         }
<a name="l00158"></a>00158 
<a name="l00159"></a>00159         <span class="comment">/*</span>
<a name="l00160"></a>00160 <span class="comment">        ** The executing flag is set whenever a request is active (pending</span>
<a name="l00161"></a>00161 <span class="comment">        ** or complete).  The AO is de-activated by scheduler just before</span>
<a name="l00162"></a>00162 <span class="comment">        ** calling the Run.</span>
<a name="l00163"></a>00163 <span class="comment">        */</span>
<a name="l00164"></a><a class="code" href="classPVActiveBase.html#a6213335340cc7af76b98ca7696448773">00164</a>         <span class="keywordtype">bool</span> <a class="code" href="classPVActiveBase.html#a6213335340cc7af76b98ca7696448773">iBusy</a>;
<a name="l00165"></a>00165 
<a name="l00184"></a><a class="code" href="classPVActiveBase.html#aa1b3b5cc0c4c5e09a55ea98bec773836">00184</a>         <a class="code" href="classOsclAOStatus.html">OsclAOStatus</a> <a class="code" href="classPVActiveBase.html#aa1b3b5cc0c4c5e09a55ea98bec773836">iStatus</a>;
<a name="l00185"></a>00185 
<a name="l00193"></a>00193         <span class="keyword">virtual</span> int32 <a class="code" href="classPVActiveBase.html#a3031119f405227e715b4441801b1fab8">RunError</a>(int32 aError) = 0;
<a name="l00194"></a>00194 
<a name="l00221"></a>00221         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPVActiveBase.html#aefdcb83177c92ddf6c2729d034288f9d">Run</a>() = 0;
<a name="l00222"></a>00222 
<a name="l00234"></a>00234         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classPVActiveBase.html#aa12bb70392debc8950613a145c1dbe74">DoCancel</a>() = 0;
<a name="l00235"></a>00235 
<a name="l00236"></a>00236         <span class="comment">/*</span>
<a name="l00237"></a>00237 <span class="comment">        ** Common methods to support OsclActiveObject and OsclTimerObject APIs</span>
<a name="l00238"></a>00238 <span class="comment">        */</span>
<a name="l00239"></a>00239         <span class="keywordtype">void</span> <a class="code" href="classPVActiveBase.html#a3063bac924180230ad80c9c984430e76">AddToScheduler</a>();
<a name="l00240"></a>00240         <span class="keywordtype">void</span> <a class="code" href="classPVActiveBase.html#a5988c0ff01573788fbbb71851e9a2862">RemoveFromScheduler</a>();
<a name="l00241"></a>00241         <span class="keywordtype">void</span> <a class="code" href="classPVActiveBase.html#a831d7c4223f3199904950fe50097b2e5">Destroy</a>();
<a name="l00242"></a>00242         <span class="keywordtype">void</span> <a class="code" href="classPVActiveBase.html#ac02e65dc6feb3b21b656a04984b47c8d">Activate</a>();
<a name="l00243"></a>00243         <a class="code" href="osclconfig_8h.html#a6de0f53c5c11f8f53ce72c70d74d9abc">OSCL_IMPORT_REF</a> <span class="keywordtype">bool</span> <a class="code" href="classPVActiveBase.html#a88b7b37e24bbd66da4287d327aa6b975">IsAdded</a>()<span class="keyword">const</span>;
<a name="l00244"></a>00244         <span class="keywordtype">void</span> <a class="code" href="classPVActiveBase.html#aa56b9569d49d6cda024db7601eeb0256">Cancel</a>();
<a name="l00245"></a>00245 
<a name="l00246"></a><a class="code" href="classPVActiveBase.html#a75ffbaa23a94ea064e1c2a1aec5ca7d0">00246</a>         <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classPVActiveBase.html#a75ffbaa23a94ea064e1c2a1aec5ca7d0">OsclSchedulerCommonBase</a>;
<a name="l00247"></a><a class="code" href="classPVActiveBase.html#a7f524fe98519510ce0d898e0388bc1bd">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#adf152df798975e05b88d70ab9c7ba327">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#a7a82d45b46262e500040b56bce8bf632">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#aaafee3544b1108aa77b0b95b23b7f12e">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#a5e60c8542d6b83ea356158b8496cd9e4">00251</a>         <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classPVActiveBase.html#a5e60c8542d6b83ea356158b8496cd9e4">OsclReadySetPosition</a>;
<a name="l00252"></a><a class="code" href="classPVActiveBase.html#a72134ea98f047ad06cef43d09de4d5cf">00252</a>         <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classOsclExecScheduler.html">OsclExecScheduler</a>;
<a name="l00253"></a>00253 
<a name="l00254"></a>00254 };
<a name="l00255"></a>00255 
<a name="l00256"></a>00256 <span class="preprocessor">#endif</span>
<a name="l00257"></a>00257 <span class="preprocessor"></span>
<a name="l00258"></a>00258 
<a name="l00259"></a>00259 
<a name="l00260"></a>00260 
</pre></div></div>
<hr size="1"><img src="pvlogo_small.jpg"><address style="align: right;"><small>OSCL API</small>
<address style="align: left;"><small>Posting Version: CORE_9.004.1.1 </small>
</small></address>
</body>
</html>