diff -r 43e37759235e -r 51a74ef9ed63 Symbian3/SDK/Source/GUID-837EF355-9154-506B-AE4F-4290FC9DBDC9.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-837EF355-9154-506B-AE4F-4290FC9DBDC9.dita Wed Mar 31 11:11:55 2010 +0100 @@ -0,0 +1,68 @@ + + + + + +Using +CAsyncOneShotThis document descrbes the use of the CAsyncOneShot class +in scheduling. +

An instance of a class derived from the CAsyncOneShot class +can be used to perform one-off processing when no higher-priority active objects +are ready to run.

+

While it has many uses, a common usage is to use it to unload a library. +A typical CAsyncOneShot derived class is defined as:

+class CLibUnloader : public CAsyncOneShot + { +public: + static CLibUnloader* NewL(RLibrary& aLibrary); + inline void Unload(); +protected: + CLibUnloader(); + ~CLibUnloader(); + virtual void RunL(); +private: + RLibrary iLib; + }; +

The static NewL() function takes a reference to an existing +open RLibrary object and creates a new CLibUnloader object:

+CLibUnloader* CLibUnloader::NewL(RLibrary& aLibrary) + { + CLibUnloader* u=new(ELeave)CLibUnloader; + u->iLib=aLibrary; + return u; + } +

The remaining functions are implemented as follows:

+ +

In other uses of CAsyncOneShot, RunL() could +do more complex processing, and indeed could re-queue the active object with +another call to CAsyncOneShot::Call().

+
\ No newline at end of file