Completion and Notification

This document describes how a device driver notifies completion of an asynchronous request.

On completion of the request, the driver calls Kern::RequestComplete(), passing the TRequestStatus object and completion error code, to notify the request completion to the user. This API internally sets the passed error code in the TRequestStatus object. It also signals the client's thread semaphore.

void DExDriverLogicalChannel::DoTxDataComplete()
    {
    ...
    // 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. Typically, the client 
    // thread, waiting using User::WaitForRequest(TRequestStatus 
    // &aStatus) or the active object framework, is unblocked and 
    // notified. Then the client may read the request status from the 
    // TRequestStatus object.
    // 
    Kern::RequestComplete(iClient,iTxDataStatus,iTxResult);
    }

The user retrieves the result of the request by calling TRequestStaus::Int().