CMsvOperationWait Class Reference

#include <mw/msvapi.h>

class CMsvOperationWait : public CActive, public CActive

Inherits from

Detailed Description

Utility class used to wait until an asynchronous messaging operation has completed.

Note that CMsvOperationActiveSchedulerWait is simpler to use, and should be used in preference to this class.

To use the class:

1. Create a new CMsvOperationWait object

2. Call the messaging function that returns the asynchronous operation. The operation observer parameter should be the iStatus word of the CMsvOperationWait object. This means that the CMsvOperationWait object will be signalled when the operation completes.

3. Call the CMsvOperationWait object's Start() function. This sets the object to be active.

4. Call CActiveScheduler::Start(). This starts a nested active scheduler. The program will then wait until this active scheduler is stopped. The CMsvOperationWait object stops the scheduler when the operation completes, allowing the program to continue.

These steps cause the program to wait until the operation completes.

     CMsvOperationWait* waiter=CMsvOperationWait::NewLC();
     CMsvOperation* op = function_returning_opLC(waiter->iStatus);
     waiter->Start();
     CActiveScheduler::Start();
     CleanupStack::PopAndDestroy(2); // op, waiter

See also: CActiveScheduler

Constructor & Destructor Documentation

CMsvOperationWait ( TInt )

CMsvOperationWait(TIntaPriority)[protected]

Constructor.

Parameters
aPriorityActive object priority

~CMsvOperationWait ( )

IMPORT_C~CMsvOperationWait()

Destructor.

Any active request on the object is cancelled.

Member Function Documentation

DoCancel ( )

voidDoCancel()[protected, virtual]

Reimplemented from CActive::DoCancel()

Implements cancellation of an outstanding request.

See also: CActive::DoCancel()

NewLC ( TInt )

IMPORT_C CMsvOperationWait *NewLC(TIntaPriority = EPriorityStandard)[static]

Allocates and constructs a new CMsvOperationWait object.

The new object is added to the active scheduler and left on the cleanup stack.

Parameters
aPriorityActive object priority. It has a default value of EPriorityStandard.
Return Value
New CMsvOperationWait object
Leave Codes
KErrNoMemory

RunL ( )

voidRunL()[protected, virtual]

Reimplemented from CActive::RunL()

Handles a request completion event.

The function stops the current active scheduler.

See also: CActive::RunL()

Start ( )

IMPORT_C voidStart()

Sets the object to be active.