Original Symbian headers
Selected EUSER, Window Server, networking, graphics and device declarations
Loading...
Searching...
No Matches
CAsyncOneShot Class Reference

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

#include <e32base.h>

Inheritance diagram for CAsyncOneShot:
CActive CBase CAsyncCallBack

Public Member Functions

IMPORT_C CAsyncOneShot (TInt aPriority)
 Constructor taking a priority value.
 
virtual IMPORT_C void DoCancel ()
 Implements cancellation of an outstanding request.
 
virtual IMPORT_C void Call ()
 Queues this active object to be run once.
 
virtual IMPORT_C ~CAsyncOneShot ()
 Frees resources prior to destruction.
 
RThread & Thread ()
 Gets a handle to the current thread.
 
- Public Member Functions inherited from CActive
IMPORT_C ~CActive ()
 Frees resources prior to destruction.
 
IMPORT_C void Cancel ()
 Cancels the wait for completion of an outstanding request.
 
IMPORT_C void Deque ()
 Removes the active object from the active scheduler's list of active objects.
 
IMPORT_C void SetPriority (TInt aPriority)
 Sets the priority of the active object.
 
TBool IsActive () const
 Determines whether the active object has a request outstanding.
 
TBool IsAdded () const
 Determines whether the active object has been added to the active scheduler's list of active objects.
 
TInt Priority () const
 Gets the priority of the active object.
 
- Public Member Functions inherited from CBase
 CBase ()
 Default constructor.
 
virtual IMPORT_C ~CBase ()
 Virtual destructor.
 
TAny * operator new (TUint aSize, TAny *aBase) __NO_THROW
 Initialises the object to binary zeroes.
 
TAny * operator new (TUint aSize) __NO_THROW
 Allocates the object from the heap and then initialises its contents to binary zeroes.
 
TAny * operator new (TUint aSize, TLeave)
 Allocates the object from the heap and then initialises its contents to binary zeroes.
 
TAny * operator new (TUint aSize, TUint aExtraSize) __NO_THROW
 Allocates the object from the heap and then initialises its contents to binary zeroes.
 
TAny * operator new (TUint aSize, TLeave, TUint aExtraSize)
 Allocates the object from the heap and then initialises its contents to binary zeroes.
 

Additional Inherited Members

- Public Types inherited from CActive
enum  TPriority {
  EPriorityIdle =-100 , EPriorityLow =-20 , EPriorityStandard =0 , EPriorityUserInput =10 ,
  EPriorityHigh =20
}
 Defines standard priorities for active objects. More...
 
- Static Public Member Functions inherited from CBase
static IMPORT_C void Delete (CBase *aPtr)
 Deletes the specified object.
 
- Public Attributes inherited from CActive
TRequestStatus iStatus
 The request status associated with an asynchronous request.
 
- Protected Member Functions inherited from CActive
IMPORT_C CActive (TInt aPriority)
 Constructs the active object with the specified priority.
 
IMPORT_C void SetActive ()
 Indicates that the active object has issued a request and that it is now outstanding.
 
virtual void RunL ()=0
 Handles an active object's request completion event.
 
virtual IMPORT_C TInt RunError (TInt aError)
 Handles a leave occurring in the request completion event handler RunL().
 
virtual IMPORT_C TInt Extension_ (TUint aExtensionId, TAny *&a0, TAny *a1)
 Extension function.
 

Detailed 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.

See also
CActive::RunL
CAsyncOneShot::Call
API status
Published to all clients. Released API.

Definition at line 1804 of file e32base.h.

Constructor & Destructor Documentation

◆ CAsyncOneShot()

IMPORT_C CAsyncOneShot::CAsyncOneShot ( TInt  aPriority)

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
aPriorityThe active object priority value. CActive::TPriority defines a standard set of priorities.

Panic condition: E32USER-CBase 93 if the attempt to open a handle to the current thread fails.

(generated from Symbian Developer Library)

◆ ~CAsyncOneShot()

IMPORT_C CAsyncOneShot::~CAsyncOneShot ( )
virtual

Frees resources prior to destruction.

Specifically, it closes the handle to the current thread.

CActive::~CActive

(generated from Symbian Developer Library)

Member Function Documentation

◆ Call()

IMPORT_C void CAsyncOneShot::Call ( )
virtual

Queues this active object to be run once.

Panic condition: E32USER-CBase 2 In debug builds only, if this active object has not already been added to the active scheduler.

(generated from Symbian Developer Library)

◆ DoCancel()

virtual IMPORT_C void CAsyncOneShot::DoCancel ( )
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().

See also
CActive::Cancel

Implements CActive.

◆ Thread()

RThread & CAsyncOneShot::Thread ( )
inline

Gets a handle to the current thread.

(generated from Symbian Developer Library)


The documentation for this class was generated from the following files: