diff -r 43e37759235e -r 51a74ef9ed63 Symbian3/SDK/Source/GUID-8BD6B29C-D905-5D2B-992A-A04AAD9ABBE3.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-8BD6B29C-D905-5D2B-992A-A04AAD9ABBE3.dita Wed Mar 31 11:11:55 2010 +0100 @@ -0,0 +1,51 @@ + + + + + +Long-running +services and background objectsThis document describes the use of background objects to respond +to requests for long-running services. +

System responsiveness is important. Threads must be responsive to their +users — a delay of more than a few hundred milliseconds is generally unacceptable.

+

This implies that all RunL() functions should +complete in a few hundred milliseconds in order to maintain system responsiveness.

+

In some cases, servicing a request may take longer than this. For example, +printing a document, or sending a file, may take seconds or minutes to execute, +but they should not hold up the main thread. It should also be possible to +cancel long running services.

+

The preferred solution is to use a background active object running in +the same thread as all other active objects

+

With this approach, the long running service is split into multiple chunks. +The RunL() function allows itself to run for a relatively +short period and then renews its request. This background active object tracks +its own progress through the long running task so that when RunL() is +next called, the it can continue from where it finished last time.

+

The background active object has a lower priority than other active objects +in the thread. The user driven event-handling active objects can cancel the +background active object by calling its Cancel() function.

+

The advantages of this approach are:

+ +

The active object framework allows the active-object implementation of +a long-running operation to be concealed from the API, so that the service +is presented to the user simply as an asynchronous request function together +with an associated cancel function.

+

In cases where an active object implementation is impossible or impractical +to program, then a background thread may be used to implement a long-running +service. This approach is not recommended for code specifically designed +for Symbian platform.

+
\ No newline at end of file