• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_timer.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> &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>
9<hr><h1>oscl_timer.h</h1><a href="oscl__timer_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="preprocessor">#ifndef OSCL_TIMER_H_INCLUDED</span>
1000002 <span class="preprocessor"></span><span class="preprocessor">#define OSCL_TIMER_H_INCLUDED</span>
1100003 <span class="preprocessor"></span>
1200004 <span class="preprocessor">#ifndef OSCL_BASE_H_INCLUDED</span>
1300005 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__base_8h.html">oscl_base.h</a>"</span>
1400006 <span class="preprocessor">#endif</span>
1500007 <span class="preprocessor"></span>
1600008 <span class="preprocessor">#ifndef OSCLCONFIG_UTIL_H_INCLUDED</span>
1700009 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="osclconfig__util_8h.html">osclconfig_util.h</a>"</span>
1800010 <span class="preprocessor">#endif</span>
1900011 <span class="preprocessor"></span>
2000012 <span class="preprocessor">#ifndef OSCL_VECTOR_H_INCLUDED</span>
2100013 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__vector_8h.html">oscl_vector.h</a>"</span>
2200014 <span class="preprocessor">#endif</span>
2300015 <span class="preprocessor"></span>
2400016 <span class="preprocessor">#ifndef OSCL_TICKCOUNT_H_INCLUDED</span>
2500017 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__tickcount_8h.html">oscl_tickcount.h</a>"</span>
2600018 <span class="preprocessor">#endif</span>
2700019 <span class="preprocessor"></span>
2800020 <span class="preprocessor">#ifndef OSCL_RAND_H_INCLUDED</span>
2900021 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__rand_8h.html">oscl_rand.h</a>"</span>
3000022 <span class="preprocessor">#endif</span>
3100023 <span class="preprocessor"></span>
3200024 <span class="preprocessor">#ifndef OSCL_SCHEDULER_AO_H_INCLUDED</span>
3300025 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="oscl__scheduler__ao_8h.html">oscl_scheduler_ao.h</a>"</span>
3400026 <span class="preprocessor">#endif</span>
3500027 <span class="preprocessor"></span>
3600028
37<a name="l00032"></a><a class="code" href="classOsclTimerObserver.html">00032</a> <span class="keyword">class </span><a class="code" href="classOsclTimerObserver.html">OsclTimerObserver</a>
3800033 {
3900034     <span class="keyword">public</span>:
4000043         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classOsclTimerObserver.html#a0">TimeoutOccurred</a>(int32 timerID, int32 timeoutInfo) = 0;
4100044
42<a name="l00045"></a><a class="code" href="classOsclTimerObserver.html#a1">00045</a>         <span class="keyword">virtual</span> <a class="code" href="classOsclTimerObserver.html#a1">~OsclTimerObserver</a>() {}
4300046 };
4400047
4500053 <span class="keyword">template</span>&lt;<span class="keyword">class</span> Alloc&gt;
4600054 <span class="keyword">class </span><a class="code" href="classOsclTimer.html">OsclTimer</a> ;
4700055
48<a name="l00056"></a><a class="code" href="classCallbackTimerObserver.html">00056</a> <span class="keyword">class </span><a class="code" href="classCallbackTimerObserver.html">CallbackTimerObserver</a>
4900057 {
5000058     <span class="keyword">public</span>:
5100059         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classCallbackTimerObserver.html#a0">TimerBaseElapsed</a>() = 0;
52<a name="l00060"></a><a class="code" href="classCallbackTimerObserver.html#a1">00060</a>         <span class="keyword">virtual</span> <a class="code" href="classCallbackTimerObserver.html#a1">~CallbackTimerObserver</a>() {}
5300061 };
5400062
5500063 <span class="keyword">template</span>&lt;<span class="keyword">class</span> Alloc&gt;
56<a name="l00064"></a><a class="code" href="classCallbackTimer.html">00064</a> <span class="keyword">class </span><a class="code" href="classCallbackTimer.html">CallbackTimer</a>: <span class="keyword">public</span> <a class="code" href="classOsclTimerObject.html">OsclTimerObject</a>
5700065 {
5800066     <span class="keyword">public</span>:
59<a name="l00067"></a><a class="code" href="classCallbackTimer.html#a0">00067</a>         <a class="code" href="classCallbackTimer.html#a0">CallbackTimer</a>(<a class="code" href="classCallbackTimerObserver.html">CallbackTimerObserver</a>&amp; aContainer, <span class="keyword">const</span> <span class="keywordtype">char</span> *name, int32 aPriority = <a class="code" href="classOsclActiveObject.html#s5s2">OsclActiveObject::EPriorityNominal</a>)
6000068                 : <a class="code" href="classOsclTimerObject.html">OsclTimerObject</a>(aPriority, name)
6100069         {
6200070             iContainer = &amp;aContainer;
6300071             <a class="code" href="classOsclTimerObject.html#a2">AddToScheduler</a>();
6400072         }
65<a name="l00073"></a><a class="code" href="classCallbackTimer.html#a1">00073</a>         <a class="code" href="classCallbackTimer.html#a1">~CallbackTimer</a>()
6600074         {
6700075             <a class="code" href="classOsclTimerObject.html#a3">RemoveFromScheduler</a>();
6800076         }
69<a name="l00077"></a><a class="code" href="classCallbackTimer.html#a2">00077</a>         <span class="keywordtype">void</span> <a class="code" href="classCallbackTimer.html#a2">Run</a>()
7000078         {
7100079             <span class="keywordflow">if</span> (<a class="code" href="classOsclTimerObject.html#a10">Status</a>() == <a class="code" href="group__osclproc.html#a0">OSCL_REQUEST_ERR_NONE</a>)
7200080                 iContainer-&gt;<a class="code" href="classCallbackTimerObserver.html#a0">TimerBaseElapsed</a>();
7300081         }
7400082     <span class="keyword">private</span>:
7500083         <a class="code" href="classCallbackTimerObserver.html">CallbackTimerObserver</a> *iContainer;
7600084 };
7700085
7800086
7900087 <span class="keyword">template</span>&lt;<span class="keyword">class</span> Alloc&gt;
80<a name="l00088"></a><a class="code" href="classOsclTimer.html">00088</a> <span class="keyword">class </span><a class="code" href="classOsclTimer.html">OsclTimer</a> : <span class="keyword">public</span> <a class="code" href="classCallbackTimerObserver.html">CallbackTimerObserver</a>
8100089 {
8200090     <span class="keyword">public</span>:
8300091
84<a name="l00092"></a><a class="code" href="classOsclTimer.html#s0">00092</a>         <span class="keyword">typedef</span> <a class="code" href="classCallbackTimer.html">CallbackTimer&lt;Alloc&gt;</a> <a class="code" href="classCallbackTimer.html">callback_timer_type</a>;
8500093
8600100         <a class="code" href="classOsclTimer.html#a0">OsclTimer</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, uint32 frequency = 1, int32 priority = <a class="code" href="classOsclActiveObject.html#s5s2">OsclActiveObject::EPriorityNominal</a>);
8700101         <span class="keyword">virtual</span> <a class="code" href="classOsclTimer.html#a1">~OsclTimer</a>();
8800102
89<a name="l00109"></a><a class="code" href="classOsclTimer.html#a2">00109</a>         <span class="keywordtype">void</span> <a class="code" href="classOsclTimer.html#a2">SetObserver</a>(<a class="code" href="classOsclTimerObserver.html">OsclTimerObserver</a> *obs)
9000110         {
9100111             iObserver = obs;
9200112         }
9300119         <span class="keywordtype">void</span> <a class="code" href="classOsclTimer.html#a3">SetFrequency</a>(uint32 frequency);
9400120
9500127         <span class="keywordtype">void</span> <a class="code" href="classOsclTimer.html#a4">SetExactFrequency</a>(uint32 frequency);
9600128
9700142         <span class="keywordtype">void</span> <a class="code" href="classOsclTimer.html#a5">Request</a>(int32 timerID, int32 timeoutInfo, int32 cycles, <a class="code" href="classOsclTimerObserver.html">OsclTimerObserver</a> *obs = 0, <span class="keywordtype">bool</span> recurring = 0);
9800151         <span class="keywordtype">void</span> <a class="code" href="classOsclTimer.html#a6">Cancel</a>(int32 timerID, int32 timeoutInfo = -1);
9900155         <span class="keywordtype">void</span> <a class="code" href="classOsclTimer.html#a7">Clear</a>();
10000156
10100157     <span class="keyword">private</span>:
10200158         <span class="comment">//Note: the timer needs to be a new'd object so that</span>
10300159         <span class="comment">//the CBase construction zeros the memory.</span>
10400160         callback_timer_type *iTimer;
10500161
10600162         <span class="keyword">typedef</span> <span class="keyword">struct  </span>_TimerEntry
10700163         {
10800164             int32 iCounter ;
10900165             int32 iTimerID ;
11000166             int32 iParam ;
11100167             <a class="code" href="classOsclTimerObserver.html">OsclTimerObserver</a> *iObserver;
11200168             <span class="keywordtype">bool</span> iRecurring;
11300169             int32 iOrigCounter;
11400170         } TimerEntry;
11500171
11600172         <span class="keyword">typedef</span> TimerEntry                    entry_type;
11700173         <span class="keyword">typedef</span> <a class="code" href="classOscl__Vector.html">Oscl_Vector&lt;entry_type*, Alloc&gt;</a> entries_type;
11800174         <span class="keyword">typedef</span> <span class="keyword">typename</span> entries_type::iterator entries_type_iterator;
11900175
12000176         <a class="code" href="classOsclTimerObserver.html">OsclTimerObserver</a> *iObserver;
12100177         entries_type iEntries;
12200178         entries_type iEntriesWaitingToAdd;
12300179         entries_type iEntriesWaitingToCancel;
12400180         <a class="code" href="classOscl__TAlloc.html">Oscl_TAlloc&lt;entry_type, Alloc&gt;</a> iEntryAllocator;
12500181
12600182         <span class="keywordtype">bool</span> iInCallback;
12700183
12800184         uint32 iCyclePeriod;
12900185         uint32 iTickCountPeriod;
13000186         uint32 iExpectedTimeout;
13100187
13200188     <span class="keyword">protected</span>:
13300189         <span class="keywordtype">void</span> <a class="code" href="classOsclTimer.html#b0">TimerBaseElapsed</a>();
134<a name="l00190"></a><a class="code" href="classOsclTimer.html#l0">00190</a>         <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classCallbackTimer.html">CallbackTimer</a>&lt;Alloc&gt;;
13500191 };
13600192
13700193 <span class="keyword">template</span>&lt;<span class="keyword">class</span> Alloc&gt;
138<a name="l00194"></a><a class="code" href="classOsclTimer.html#a0">00194</a> <a class="code" href="classOsclTimer.html#a0">OsclTimer&lt;Alloc&gt;::OsclTimer</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, uint32 frequency, int32 priority) :
13900195         iObserver(0)
14000196         , iInCallback(false)
14100197         , iTickCountPeriod(0)
14200198         , iExpectedTimeout(0)
14300199 {
14400200     <span class="comment">//use the allocator with placement 'new'</span>
14500201     Alloc alloc;
14600202     iTimer = <a class="code" href="group__osclmemory.html#a53">OSCL_PLACEMENT_NEW</a>(alloc.ALLOCATE(<span class="keyword">sizeof</span>(<a class="code" href="classCallbackTimer.html">CallbackTimer&lt;Alloc&gt;</a>)), <a class="code" href="classCallbackTimer.html">CallbackTimer&lt;Alloc&gt;</a>(*<span class="keyword">this</span>, name, priority));
14700203     <a class="code" href="classOsclTimer.html#a3">SetFrequency</a>(frequency);
14800204 }
14900205
15000206 <span class="keyword">template</span>&lt;<span class="keyword">class</span> Alloc&gt;
151<a name="l00207"></a><a class="code" href="classOsclTimer.html#a1">00207</a> <a class="code" href="classOsclTimer.html#a1">OsclTimer&lt;Alloc&gt;::~OsclTimer</a>()
15200208 {
15300209     <span class="comment">// Make sure we're cancelled</span>
15400210     <span class="keywordflow">if</span> (iTimer)
15500211         iTimer-&gt;<a class="code" href="classOsclTimerObject.html#a8">Cancel</a>();
15600212     <span class="keywordflow">if</span> (iTimer)
15700213     {
15800214         iTimer-&gt;OSCL_TEMPLATED_DESTRUCTOR_CALL(<a class="code" href="classCallbackTimer.html">callback_timer_type</a>, <a class="code" href="classCallbackTimer.html">CallbackTimer</a>);
15900215         Alloc alloc;
16000216         alloc.deallocate(iTimer);
16100217     }
16200218     iTimer = <a class="code" href="group__osclbase.html#a81">NULL</a>;
16300219
16400220     <span class="keywordflow">for</span> (entries_type_iterator it = iEntries.<a class="code" href="classOscl__Vector.html#a17">begin</a>(); it != iEntries.<a class="code" href="classOscl__Vector.html#a18">end</a>(); it++)
16500221     {
16600222         iEntryAllocator.<a class="code" href="classOscl__TAlloc.html#a5">deallocate</a>(*it);
16700223     }
16800224 }
16900225
17000226 <span class="keyword">template</span>&lt;<span class="keyword">class</span> Alloc&gt;
171<a name="l00227"></a><a class="code" href="classOsclTimer.html#a3">00227</a> <span class="keywordtype">void</span> <a class="code" href="classOsclTimer.html#a3">OsclTimer&lt;Alloc&gt;::SetFrequency</a>(uint32 frequency)
17200228 {
17300229     <span class="comment">// timer takes microseconds</span>
17400230     iCyclePeriod = 1000000 / frequency;
17500231     <span class="comment">// get tick count period</span>
17600232     iTickCountPeriod = <a class="code" href="classOsclTickCount.html#d2">OsclTickCount::TickCountPeriod</a>();
17700233 }
17800234
17900235 <span class="keyword">template</span>&lt;<span class="keyword">class</span> Alloc&gt;
180<a name="l00236"></a><a class="code" href="classOsclTimer.html#a4">00236</a> <span class="keywordtype">void</span> <a class="code" href="classOsclTimer.html#a4">OsclTimer&lt;Alloc&gt;::SetExactFrequency</a>(uint32 frequency)
18100237 {
18200238     <span class="comment">// timer takes microseconds</span>
18300239     iCyclePeriod = frequency;
18400240     <span class="comment">// get tick count period</span>
18500241     iTickCountPeriod = <a class="code" href="classOsclTickCount.html#d2">OsclTickCount::TickCountPeriod</a>();
18600242 }
18700243
18800244 <span class="comment">// Request a timer</span>
18900245 <span class="keyword">template</span>&lt;<span class="keyword">class</span> Alloc&gt;
190<a name="l00246"></a><a class="code" href="classOsclTimer.html#a5">00246</a> <span class="keywordtype">void</span> <a class="code" href="classOsclTimer.html#a5">OsclTimer&lt;Alloc&gt;::Request</a>(int32 timerID, int32 param, int32 cycles, <a class="code" href="classOsclTimerObserver.html">OsclTimerObserver</a> *obs, <span class="keywordtype">bool</span> recurring)
19100247 {
19200248
19300249     <span class="comment">// add to list of timers</span>
19400250     entry_type *entry = iEntryAllocator.ALLOCATE(1);
19500251     entry-&gt;iTimerID = timerID;
19600252     entry-&gt;iParam = param;
19700253     entry-&gt;iCounter = cycles;
19800254     entry-&gt;iObserver = obs;
19900255     entry-&gt;iRecurring = recurring;
20000256     entry-&gt;iOrigCounter = entry-&gt;iCounter;
20100257
20200258     <span class="comment">// if the request is called inside of a callback, then we must add it later</span>
20300259     <span class="keywordflow">if</span> (iInCallback)
20400260     {
20500261         iEntriesWaitingToAdd.<a class="code" href="classOscl__Vector.html#a5">push_back</a>(entry);
20600262         <span class="keywordflow">return</span>;
20700263     }
20800264
20900265     iEntries.<a class="code" href="classOscl__Vector.html#a5">push_back</a>(entry);
21000266
21100267     <span class="keywordflow">if</span> (iTimer)
21200268     {
21300269         iTimer-&gt;<a class="code" href="classOsclTimerObject.html#a5">RunIfNotReady</a>(iCyclePeriod);
21400270     }
21500271
21600272     <span class="keywordflow">if</span> (iExpectedTimeout == 0)
21700273     {
21800274         iExpectedTimeout = (<a class="code" href="classOsclTickCount.html#d0">OsclTickCount::TickCount</a>() * iTickCountPeriod) + iCyclePeriod;
21900275     }
22000276 }
22100277
22200278 <span class="comment">// Cancel a timer</span>
22300279 <span class="keyword">template</span>&lt;<span class="keyword">class</span> Alloc&gt;
224<a name="l00280"></a><a class="code" href="classOsclTimer.html#a6">00280</a> <span class="keywordtype">void</span> <a class="code" href="classOsclTimer.html#a6">OsclTimer&lt;Alloc&gt;::Cancel</a>(int32 timerID, int32 param)
22500281 {
22600282
22700283     <span class="keywordflow">if</span> (iInCallback)
22800284     {
22900285         <span class="comment">// add to list of timers</span>
23000286         entry_type *entry = iEntryAllocator.ALLOCATE(1);
23100287         entry-&gt;iTimerID = timerID;
23200288         entry-&gt;iParam = param;
23300289
23400290         iEntriesWaitingToCancel.<a class="code" href="classOscl__Vector.html#a5">push_back</a>(entry);
23500291         <span class="keywordflow">return</span>;
23600292     }
23700293
23800294     <span class="comment">// remove from list of timers</span>
23900295     <span class="keywordflow">for</span> (entries_type_iterator it = iEntries.<a class="code" href="classOscl__Vector.html#a17">begin</a>(); it != iEntries.<a class="code" href="classOscl__Vector.html#a18">end</a>(); it++)
24000296     {
24100297         <span class="keywordflow">if</span> ((*it)-&gt;iTimerID == timerID)
24200298         {
24300299             <span class="comment">// make sure the param matches unless it is not specified (-1)</span>
24400300             <span class="keywordflow">if</span> ((*it)-&gt;iParam == param || param == -1)
24500301             {
24600302                 iEntryAllocator.<a class="code" href="classOscl__TAlloc.html#a5">deallocate</a>(*it);
24700303                 iEntries.<a class="code" href="classOscl__Vector.html#a19">erase</a>(it);
24800304                 <span class="keywordflow">return</span>;
24900305             }
25000306         }
25100307     }
25200308 }
25300309
25400310 <span class="comment">// Clear all waiting timers</span>
25500311 <span class="keyword">template</span>&lt;<span class="keyword">class</span> Alloc&gt;
256<a name="l00312"></a><a class="code" href="classOsclTimer.html#a7">00312</a> <span class="keywordtype">void</span> <a class="code" href="classOsclTimer.html#a7">OsclTimer&lt;Alloc&gt;::Clear</a>()
25700313 {
25800314     <span class="keywordflow">for</span> (entries_type_iterator it = iEntries.<a class="code" href="classOscl__Vector.html#a17">begin</a>(); it != iEntries.<a class="code" href="classOscl__Vector.html#a18">end</a>(); it++)
25900315     {
26000316         iEntryAllocator.<a class="code" href="classOscl__TAlloc.html#a5">deallocate</a>(*it);
26100317     }
26200318     iEntries.<a class="code" href="classOscl__Vector.html#a15">clear</a>();
26300319 }
26400320
26500321 <span class="keyword">template</span>&lt;<span class="keyword">class</span> Alloc&gt;
266<a name="l00322"></a><a class="code" href="classOsclTimer.html#b0">00322</a> <span class="keywordtype">void</span> <a class="code" href="classOsclTimer.html#b0">OsclTimer&lt;Alloc&gt;::TimerBaseElapsed</a>()
26700323 {
26800324     uint8 expiredFound = 0;
26900325
27000326     {
27100327         <span class="comment">// call all whose timers have expired</span>
27200328         <span class="keywordflow">for</span> (entries_type_iterator it = iEntries.<a class="code" href="classOscl__Vector.html#a17">begin</a>(); it != iEntries.<a class="code" href="classOscl__Vector.html#a18">end</a>(); it++)
27300329         {
27400330             entry_type *entry = (*it);
27500331             <span class="keywordflow">if</span> (--(entry-&gt;iCounter) &lt;= 0)
27600332             {
27700333                 <span class="keywordflow">if</span> (!entry-&gt;iRecurring) expiredFound = 1;
27800334                 <span class="keywordflow">if</span> (entry-&gt;iRecurring) entry-&gt;iCounter = entry-&gt;iOrigCounter;
27900335
28000336                 <span class="comment">// use local observer if it exists, otherwise use global observer</span>
28100337                 <a class="code" href="classOsclTimerObserver.html">OsclTimerObserver</a> *obs = (entry-&gt;iObserver ? entry-&gt;iObserver : iObserver);
28200338                 <span class="keywordflow">if</span> (obs)
28300339                 {
28400340                     iInCallback = <span class="keyword">true</span>;
28500341                     obs-&gt;<a class="code" href="classOsclTimerObserver.html#a0">TimeoutOccurred</a>(entry-&gt;iTimerID, entry-&gt;iParam);
28600342                     iInCallback = <span class="keyword">false</span>;
28700343                 }
28800344             }
28900345         }
29000346     }
29100347
29200348     <span class="comment">// remove from list all whose timers have expired</span>
29300349     <span class="keywordflow">while</span> (expiredFound)
29400350     {
29500351         expiredFound = 0;
29600352         <span class="keywordflow">for</span> (entries_type_iterator it = iEntries.<a class="code" href="classOscl__Vector.html#a17">begin</a>(); it != iEntries.<a class="code" href="classOscl__Vector.html#a18">end</a>(); it++)
29700353         {
29800354             entry_type *entry = (*it);
29900355             <span class="keywordflow">if</span> (entry-&gt;iCounter &lt;= 0)
30000356             {
30100357                 expiredFound = 1;
30200358                 iEntryAllocator.<a class="code" href="classOscl__TAlloc.html#a5">deallocate</a>(entry);
30300359                 iEntries.<a class="code" href="classOscl__Vector.html#a19">erase</a>(it);
30400360                 <span class="keywordflow">break</span>;
30500361             }
30600362         }
30700363     }
30800364
30900365     {
31000366         <span class="comment">// if any timers were cancelled in the callback, process them now</span>
31100367         <span class="keywordflow">for</span> (entries_type_iterator it = iEntriesWaitingToCancel.<a class="code" href="classOscl__Vector.html#a17">begin</a>(); it != iEntriesWaitingToCancel.<a class="code" href="classOscl__Vector.html#a18">end</a>(); it++)
31200368         {
31300369             entry_type *entry = (*it);
31400370             <a class="code" href="classOsclTimer.html#a6">Cancel</a>(entry-&gt;iTimerID, entry-&gt;iParam);
31500371             iEntryAllocator.<a class="code" href="classOscl__TAlloc.html#a5">deallocate</a>(entry);
31600372         }
31700373         iEntriesWaitingToCancel.<a class="code" href="classOscl__Vector.html#a15">clear</a>();
31800374     }
31900375
32000376     {
32100377         <span class="comment">// if any timers were requested in the callback, process them now</span>
32200378         <span class="keywordflow">for</span> (entries_type_iterator it = iEntriesWaitingToAdd.<a class="code" href="classOscl__Vector.html#a17">begin</a>(); it != iEntriesWaitingToAdd.<a class="code" href="classOscl__Vector.html#a18">end</a>(); it++)
32300379         {
32400380             entry_type *entry = (*it);
32500381             <a class="code" href="classOsclTimer.html#a5">Request</a>(entry-&gt;iTimerID, entry-&gt;iParam, entry-&gt;iCounter, entry-&gt;iObserver);
32600382             iEntryAllocator.<a class="code" href="classOscl__TAlloc.html#a5">deallocate</a>(entry);
32700383         }
32800384         iEntriesWaitingToAdd.<a class="code" href="classOscl__Vector.html#a15">clear</a>();
32900385     }
33000386
33100387     <span class="keywordflow">if</span> (!iEntries.<a class="code" href="classOscl__Vector__Base.html#a2">empty</a>())
33200388     {
33300389         <span class="comment">// adjust for the jitter</span>
33400390         uint32 time = <a class="code" href="classOsclTickCount.html#d0">OsclTickCount::TickCount</a>() * iTickCountPeriod;
33500391         int32 jitter = time - iExpectedTimeout;
33600392         int32 waitperiod = iCyclePeriod - jitter;
33700393
33800394         <span class="comment">// currently there is some problem on the phone if we send</span>
33900395         <span class="comment">// in real-time rather than with a slower (growing delay) H.223 mux output</span>
34000396         <span class="comment">// if jitter is too large in either direction, start over</span>
34100397         <span class="keywordflow">if</span> ((uint)<a class="code" href="group__osclbase.html#a93">OSCL_ABS</a>(jitter) &gt; iCyclePeriod)
34200398         {
34300399             iExpectedTimeout = time;
34400400         }
34500401         <span class="keywordflow">else</span>
34600402         {
34700403             iExpectedTimeout += iCyclePeriod;
34800404         }
34900405
35000406         waitperiod = <a class="code" href="group__osclbase.html#a92">OSCL_MAX</a>(waitperiod, 0);
35100407
35200408         <span class="keywordflow">if</span> (iTimer)
35300409         {
35400410             iTimer-&gt;<a class="code" href="classOsclTimerObject.html#a5">RunIfNotReady</a>(waitperiod);
35500411         }
35600412     }
35700413     <span class="keywordflow">else</span>
35800414     {
35900415         iExpectedTimeout = 0;
36000416     }
36100417 }
36200418
36300419
36400420
36500421 <span class="preprocessor">#endif</span>
366</pre></div><hr size="1"><img src="pvlogo_small.jpg"><address style="align: right;"><small>OSCL API</small>
367<address style="align: left;"><small>Posting Version: OPENCORE_20090310 </small>
368</small></address>
369</body>
370</html>
371