Asynchronous service provider's responsibilities

This document describes the functionality required from an asynchronous service provider.

An asynchronous service provider must interact in the following ways with its clients:

  • prior to initiating a request, a request function must set the value of the passed TRequestStatus to KRequestPending, which indicates that a request has been issued but not completed.

  • requests must be completed by signalling the requesting thread’s request semaphore by calling RThread::RequestComplete() with the TRequestStatus as the first parameter and the completion code as the second parameter (which is placed in the TRequestStatus).

  • there must be a cancel function which can cancel an outstanding request. In some cases, calling the cancel function does not cause cancellation because the request is already complete. In all cases, the request must be complete before the cancel function returns.

  • if an asynchronous request is made, it must complete precisely once, whether normally, abnormally, or through cancellation.

  • completion through cancellation is often indicated by a TRequestStatus code of KErrCancel.

See also