03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

};<br />

Figure 17.9<br />

Member functions here are as follows:<br />

Function Description<br />

~CActive() Virtual destructor. Calls Deque() to de-queue the object from the<br />

active scheduler.<br />

Cancel() Cancels a request. If a request is active, calls<br />

DoCancel(), waits synchronously for completion on iStatus and sets the request<br />

as no longer active.<br />

SetPriority() Changes the priority after construction.<br />

Priority() Returns the active object's priority.<br />

IsActive() Indicates whether a request is outstanding.<br />

Deque() Removes this object from the active scheduler.<br />

IsAdded() Indicates whether the object has been added to the active scheduler.<br />

CActive() C++ constructor: you must specify the active object's priority as a<br />

constructor parameter.<br />

SetActive() Call this function after you have issued a request function to indicate<br />

that a request is outstanding.<br />

DoCancel() Implement this in a derived class to cancel a request issued to an<br />

asynchronous service provider. This function can only be called if a<br />

request is active. You must provide a way to cancel requests.<br />

RunL() Implement this in a derived class to handle the completion of a<br />

request that was issued.<br />

RunError() This should be overridden if the RunL()implementation calls a leaving<br />

function. The TInt parameter is the leave code from RunL().<br />

I've not yet met a case in which Deque() or SetPriority() are necessary or couldn't be<br />

handled by a different design approach. Bizarrely, although Deque() is a member of<br />

CActive, which enables you to remove an active object from the scheduler, you can only<br />

add an active object to the scheduler using a member function of<br />

CActiveScheduler(which is a friend class).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!