diff -r 578be2adaf3e -r 307f4279f433 Adaptation/GUID-F367F6C9-66F7-4061-81A7-0C845D8F39C4.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Adaptation/GUID-F367F6C9-66F7-4061-81A7-0C845D8F39C4.dita Fri Oct 15 14:32:18 2010 +0100 @@ -0,0 +1,61 @@ + + + + + +Cancellation +of Asynchronous RequestsThis document describes how a device driver cancels an asynchronous +request. +

Any outstanding asynchronous request can be cancelled. DoCancel() is +implemented to handle cancel requests. Cancel requests are either explicitly +made by the user or made when there is a close message. Any pending requests +and queued DFCs are cancelled and the request is completed with KErrCancel.

+/** + Cancel Asynchronous Requests. This is called from HandleMsg() to + cancel pending asynchronous requests. This function determines which + operation is to be cancelled and tidies up the resources specific to + the request being cancelled, any outstanding DFCs, and timers, and + signals the client that the operation is completed. + + @param aMask + Mask containing the request number that has to be cancelled + */ +void DExDriverLogicalChannel::DoCancel(TUint aMask) + { + ... + // Any pending asynchronous operation can be + // cancelled. Check a valid asynchronous request + // to cancel has been specified. + // + if(aMask&(1<<RExDriverChannel::ERequestTransmitData)) + { + if (iTxDataStatus) + { + // If it is a Transmit request, cancel the Transmit DFC. + // TDfc::Cancel() cancels the DFC if it is already + // queued. It does nothing if the DFC is not queued. + // + iTxDfc.Cancel(); + + // Notify the client (iClient) that the request is + // completed. The TRequestStatus object is updated with the + // status and the completion code is provided to the + // client. KErrCancel indicates that the request has been + // cancelled. Typically, a client thread, waiting on + // User::WaitForRequest(TRequestStatus &aStatus) or using + // the active object framework, is unblocked and notified. + // Then the client may read the request status from the + // TRequestStatus object. + // + Kern::RequestComplete(iClient,iTxDataStatus,KErrCancel); + } + } + ... + } +
\ No newline at end of file