class CDeltaTimer : public CActive |
A queue of timed events.
A timed event is a callback function encapsulated by a TDeltaTimerEntry object, and is intended to be called when the time interval represented by the event expires.
The queue itself is a TDeltaQue list. A timed event entry is added into a position in the queue that is determined by the time interval specified for that event. Although the time interval for a timed event is specified as an interval from the present moment, when added to the queue the implementation treats each event as having an interval from the previous timed event (or now).
CDeltaTimer is an active object, driven by an RTimer which is usually set to expire upon completion of the event at the head of the queue. If the time to the next event is too great or an event at the head of the queue has been removed, the timer may be set to expire prior to the event at the head of the queue (if any).
When the timer completes, the head of the queue is inspected to see whether the timed event at the head of the queue has expired. On expiry, the callback function represented by that timed event is called, and the timed event entry is removed from the queue. The queue then inspects further events for expiry, calling and removing them as necessary until either the queue is empty or there is an event in the future to wait for.
Note that the tick period is the minimum time interval for an event and the granularity of all timings using the queue. Note that in general, any event may be called back some time after it has expired and that specifically the duration of all events will at least be rounded up to a muliple of the tick period.
Public Member Functions | |
---|---|
~CDeltaTimer() | |
IMPORT_C CDeltaTimer * | NewL(TInt) |
IMPORT_C CDeltaTimer * | NewL(TInt, TTimeIntervalMicroSeconds32) |
IMPORT_C void | Queue(TTimeIntervalMicroSeconds32, TDeltaTimerEntry &) |
IMPORT_C TInt | QueueLong(TTimeIntervalMicroSeconds, TDeltaTimerEntry &) |
IMPORT_C void | Remove(TDeltaTimerEntry &) |
Private Member Functions | |
---|---|
CDeltaTimer(TInt, TInt) | |
void | Activate(TBool) |
void | DoCancel() |
void | RunL() |
Inherited Enumerations | |
---|---|
CActive:TPriority |
Private Attributes | |
---|---|
TTickCountQue | iQueue |
TBool | iQueueBusy |
const TInt | iTickPeriod |
RTimer | iTimer |
Inherited Attributes | |
---|---|
CActive::iStatus |
CDeltaTimer | ( | TInt | aPriority, |
TInt | aTickPeriod | ||
) | [private] |
Constructor taking an active object priority value.
The constructor sets this active object's priority value through a call to the base class constructor in its c'tor list.
void | Activate | ( | TBool | aRequeueTimer = EFalse | ) | [private] |
Issues a new RTimer request, if there is no outstanding request and the queue is not empty.
TBool aRequeueTimer = EFalse |
void | DoCancel | ( | ) | [private, virtual] |
Implements cancellation of an oustanding RTimer request.
IMPORT_C CDeltaTimer * | NewL | ( | TInt | aPriority | ) | [static] |
Creates a new timed event queue with the specified active object priority.
TInt aPriority | The priority of this active object. |
IMPORT_C CDeltaTimer * | NewL | ( | TInt | aPriority, |
TTimeIntervalMicroSeconds32 | aGranularity | |||
) | [static] |
Creates a new timed event queue with the specified active object priority, and the specified timer granularity.
TInt aPriority | The priority of this active object. |
TTimeIntervalMicroSeconds32 aGranularity | Ignored. The resolution of the timer is the tick period. |
IMPORT_C void | Queue | ( | TTimeIntervalMicroSeconds32 | aTimeInMicroSeconds, |
TDeltaTimerEntry & | aEntry | |||
) | [virtual] |
Adds a new timed event entry into the timed event queue.
TTimeIntervalMicroSeconds32 aTimeInMicroSeconds | The interval from the present time when the timed event entry is to expire. |
TDeltaTimerEntry & aEntry | The timed event entry encapsulating the call back that is to be called when this timed event entry expires. |
IMPORT_C TInt | QueueLong | ( | TTimeIntervalMicroSeconds | aTimeInMicroSeconds, |
TDeltaTimerEntry & | aEntry | |||
) |
Adds a new timed event entry into the timed event queue.
TTimeIntervalMicroSeconds aTimeInMicroSeconds | The interval from the present time when the timed event entry is to expire. |
TDeltaTimerEntry & aEntry | The timed event entry encapsulating the call back that is to be called when this timed event entry expires. |
IMPORT_C void | Remove | ( | TDeltaTimerEntry & | aEntry | ) | [virtual] |
Removes the specified timed event entry from the timer queue.
TDeltaTimerEntry & aEntry | The timed event entry. |
void | RunL | ( | ) | [private, virtual] |
Deals with an RTimer completion event.
The function inspects the timed event entry at the head of the queue, and reduces its timer value by the appropriate amount. If this timed event is now found to have expired, the call back function is called, and the timed event entry removed from the queue.
If the timed event entry has not expired, it remains at the head of the queue.
The function issues a new RTimer request, using the timer granularity value as the time interval.
TBool | iQueueBusy | [private] |
Pseudo-lock on the the queue to avoid reentrancy problems
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.