Symbian
Symbian OS Library

SYMBIAN OS V9.3

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



Location: e32base.h
Link against: euser.lib

Class CAsyncOneShot

class CAsyncOneShot : public CActive;

Description

An active object that performs processing that is only performed once.

The active object is intended to be given a low priority, so that it runs only when no higher-priority active objects are ready to run. In addition, the class ensures that the current thread cannot be closed until the active object is destroyed.

The class needs to be derived from to make use of its behaviour, in particular, it needs to define and implement a RunL() function.

NB: the constructor creates a process-relative handle to the current thread and this is stored within this object. If the thread subsequently dies abnormally, then this handle will not be closed, and the thread will not be destroyed until the process terminates.

NB: if Call() is called from a different thread (for example, to implement a kind of inter-thread communication), a client-specific mechanism must be used to ensure that the thread that created this object is still alive.

NB: if the thread that created this object has its own heap and terminates abnormally, then the handle stored within this object is lost.

Derivation

Members

Defined in CAsyncOneShot:
CAsyncOneShot(), Call(), DoCancel(), Thread(), ~CAsyncOneShot()

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

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


Construction and destruction


CAsyncOneShot()

IMPORT_C CAsyncOneShot(TInt aPriority);

Description

Constructor taking a priority value.

Specifically, the constructor:

1. sets this active object's priority value

2. opens a handle to the current thread to ensure that the thread cannot be closed until this CAsyncOneShot object is destroyed

3. adds this active object to the current active scheduler.

Parameters

TInt aPriority

The active object priority value. CActive::TPriority defines a standard set of priorities.

Panic codes

E32USER-CBase

93 if the attempt to open a handle to the current thread fails.


~CAsyncOneShot()

virtual IMPORT_C ~CAsyncOneShot();

Description

Frees resources prior to destruction.

Specifically, it closes the handle to the current thread.

[Top]


Member functions


DoCancel()

virtual IMPORT_C void DoCancel();

Description

Implements cancellation of an outstanding request.

The class provides an empty implementation.

This is called by the destructor.


Call()

virtual IMPORT_C void Call();

Description

Queues this active object to be run once.

Panic codes

E32USER-CBase

2 In debug builds only, if this active object has not already been added to the active scheduler.


Thread()

inline RThread &Thread();

Description

Gets a handle to the current thread.

Return value

RThread &

The handle to the current thread.