CAsyncOneShot Class Reference

class CAsyncOneShot : public CActive

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.

CActive::RunL

CAsyncOneShot::Call

Inherits from

Constructor & Destructor Documentation

CAsyncOneShot(TInt)

IMPORT_CCAsyncOneShot(TIntaPriority)

Parameters

TInt aPriority

~CAsyncOneShot()

IMPORT_C~CAsyncOneShot()[virtual]

Member Functions Documentation

Call()

IMPORT_C voidCall()[virtual]

DoCancel()

IMPORT_C voidDoCancel()[virtual]

Implements cancellation of an outstanding request.

This function is called as part of the active object's Cancel().

It must call the appropriate cancel function offered by the active object's asynchronous service provider. The asynchronous service provider's cancel is expected to act immediately.

DoCancel() must not wait for event completion; this is handled by Cancel().

CActive::Cancel

Setup()

voidSetup()[private]

Thread()

RThread &Thread()[inline]

Gets a handle to the current thread.

The handle to the current thread.

Member Data Documentation

RThread iThread

RThread iThread[private]