Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]


Cancelling an asynchronous request

Most asynchronous service providers support a cancel function. This allows an outstanding request to be cancelled before it is complete.

A single thread that is waiting for a single asynchronous request to complete cannot cancel that request because the thread is asleep until it completes. However, when multiple requests are outstanding, the handling of a request completion may involve cancelling some or all of the other outstanding requests.

In all cases, the correct user protocol for cancellation is:

    // only cancel if we know that there is
    // an outstanding request
if (requestIssued)
    {
        // Issue cancel to service provider
    provider.cancel();

        // Wait for it complete (it must complete)
    User::WaitForRequest(requestStatus);

        // Now note that request is no longer outstanding
    requestIssued=EFalse;
    }

[Top]


Notes