--- a/kernel/eka/kernel/stimer.cpp Thu Aug 19 11:14:22 2010 +0300
+++ b/kernel/eka/kernel/stimer.cpp Tue Aug 31 16:34:26 2010 +0300
@@ -1071,18 +1071,31 @@
DTimer* pT=FromPtr(aTimer);
NKern::LockSystem();
pT->iTimer.iState = (TUint8)TTimer::EIdle;
- Kern::QueueRequestComplete(pT->Owner(), pT->iTimer.iRequest,KErrNone);
+ Kern::QueueRequestComplete(pT->Owner(), pT->iTimer.iRequest, KErrNone);
NKern::UnlockSystem();
}
-void DTimer::HighRes(TRequestStatus& aStatus, TInt anInterval)
+void DTimer::HighRes(TRequestStatus& aStatus, TInt aInterval)
{
// enter and return with system locked
- TInt r=iTimer.AfterHighRes(anInterval,MsComplete,aStatus);
+ TInt r=iTimer.AfterHighRes(aInterval,MsComplete,aStatus);
if (r!=KErrNone)
K::PanicCurrentThread(ETimerAlreadyPending);
}
+void DTimer::AgainHighRes(TRequestStatus& aStatus, TInt aInterval)
+ {
+ // enter and return with system locked
+ TInt r=iTimer.AgainHighRes(aInterval,MsComplete,aStatus);
+ if (r==KErrInUse)
+ K::PanicCurrentThread(ETimerAlreadyPending);
+ else if (r!=KErrNone)
+ {
+ TRequestStatus* status = &aStatus;
+ Kern::RequestComplete(status, r);
+ }
+ }
+
void DTimer::Cancel()
//
// Cancel an outstanding request.
@@ -1191,7 +1204,7 @@
iType=(TUint8)aType;
}
-TInt TTimer::AfterHighRes(TInt anInterval, NTimerFn aFunction, TRequestStatus& aStatus)
+TInt TTimer::AfterHighRes(TInt aInterval, NTimerFn aFunction, TRequestStatus& aStatus)
{
// enter and return with system locked
if (iState!=EIdle || iRequest->SetStatus(&aStatus) != KErrNone)
@@ -1199,12 +1212,37 @@
iState = (TUint8)EWaitHighRes;
SetType(EHighRes);
TInt msp=NTickPeriod();
- TInt t=(TInt)(((TUint)anInterval+msp-1)/msp); // convert microseconds to milliseconds, rounding up
+ TInt t=(TInt)(((TUint)aInterval+msp-1)/msp); // convert microseconds to milliseconds, rounding up
new (&Ms()) NTimer(aFunction,this);
Ms().OneShot(t,ETrue); // start millisecond timer, complete in DFC
return KErrNone;
}
+TInt TTimer::AgainHighRes(TInt aInterval, NTimerFn aFunction, TRequestStatus& aStatus)
+ {
+ // enter and return with system locked
+ if (iState!=EIdle)
+ return KErrInUse;
+ if (iType!=EHighRes)
+ return AfterHighRes(aInterval, aFunction, aStatus);
+ if (iRequest->SetStatus(&aStatus) != KErrNone)
+ return KErrInUse;
+ iState = (TUint8)EWaitHighRes;
+ TInt msp=NTickPeriod();
+ TInt t;
+ if (aInterval>=0)
+ t = (TInt)(((TUint)aInterval+msp-1)/msp); // convert microseconds to milliseconds, rounding up
+ else
+ t = aInterval/msp; // convert microseconds to milliseconds, rounding up
+ TInt r = Ms().Again(t); // start millisecond timer, complete in DFC
+ if (r != KErrNone)
+ {
+ iState=(TUint8)EIdle;
+ iRequest->Reset();
+ }
+ return r;
+ }
+
void TTimer::Cancel(DThread* aThread)
//
// Cancel an outstanding request.
@@ -1393,6 +1431,12 @@
aTimer->HighRes(aStatus,aTime);
}
+void ExecHandler::TimerAgainHighRes(DTimer* aTimer, TRequestStatus& aStatus, TInt aTime)
+ {
+ __KTRACE_OPT(KEXEC,Kern::Printf("Exec::TimerAgainHighRes"));
+ aTimer->AgainHighRes(aStatus,aTime);
+ }
+
void ExecHandler::TimerAt(DTimer* aTimer, TRequestStatus& aStatus, TUint32 aTimeLo, TUint32 aTimeHi)
{
__KTRACE_OPT(KEXEC,Kern::Printf("Exec::TimerAt"));