Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: e32base.h
Link against: euser.lib

Class CIdle

class CIdle : public CActive;

Description

An active object that performs low-priority processing when no higher-priority active objects are ready to run.

An idle time active object together with its associated callback function may be used to implement potentially long running background tasks, such as spreadsheet recalculation and word processor repagination.

Derivation

Members

Defined in CIdle:
CIdle(), DoCancel(), New(), NewL(), RunL(), Start(), iCallBack, ~CIdle()

Inherited from CActive:
Cancel(), Deque(), EPriorityHigh, EPriorityIdle, EPriorityLow, EPriorityStandard, EPriorityUserInput, Extension_(), IsActive(), IsAdded(), Priority(), RunError(), SetActive(), SetPriority(), TPriority, iStatus

Inherited from CBase:
Delete(), operator new()


Construction and destruction


NewL()

static IMPORT_C CIdle *NewL(TInt aPriority);

Description

Allocates and initialises an Idle time active object, adds it to the active scheduler, but leaves on failure.

Parameters

TInt aPriority

An integer specifying the priority of this active object. It must be lower than that of all other active objects on the active scheduler. The value CActive::TPriority::EPriorityIdle is recommended.

Return value

CIdle *

Pointer to the new Idle time active object.


~CIdle()

IMPORT_C ~CIdle();

Description

Frees resources prior to destruction.

Specifically, it cancels any outstanding request.


CIdle()

protected: IMPORT_C CIdle(TInt aPriority);

Description

Protected constructor taking a priority value.

Sets this active object's priority value.

Parameters

TInt aPriority

The active object priority value.

[Top]


Member functions


New()

static IMPORT_C CIdle *New(TInt aPriority);

Description

Allocates and initialises an Idle time active object and adds it to the active scheduler.

Parameters

TInt aPriority

An integer specifying the priority of this active object. It must be lower than that of all other active objects on the active scheduler. The value CActive::TPriority::EPriorityIdle is recommended.

Return value

CIdle *

Pointer to the new Idle time active object, or NULL if the object could not be created.


Start()

IMPORT_C void Start(TCallBack aCallBack);

Description

Starts the background task.

The background task is encapsulated in the callback. The function represented by this callback is called every time this Idle time active object is scheduled to run.

The callback function should be structured to perform a background task in many increments, i.e. it should voluntarily relinquish control (i.e. return) after a suitable time interval to allow other, higher priority events to be handled.

If the callback function has further work to do, it should return a true value. This ensures that the active object is scheduled to run again later.

Once the callback function has finally completed its work, it should return a false value. The active object is then no longer scheduled to run.

Parameters

TCallBack aCallBack

A callback object encapsulating a function which is called when no higher priority active object is ready to run.


RunL()

protected: virtual IMPORT_C void RunL();

Description

Handles this idle active object's request completion event.

It is called when nothing of a higher priority can be scheduled.


DoCancel()

protected: virtual IMPORT_C void DoCancel();

Description

Implements the cancellation of an outstanding request.

This function is called by the active object's Cancel() function.

[Top]


Member data


iCallBack

protected: TCallBack iCallBack;

Description

The callback object that encapsulates the background task.