|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept id="GUID-1294F540-FDA7-5050-BAFB-3C9888491B98" xml:lang="en"><title>Asynchronous |
|
13 Services Overview</title><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <section id="GUID-6F9E9225-A8E2-41C9-B7B5-A89E2800445C"><title>Purpose</title> <p>Provides low-level and high-level idioms |
|
15 by which one thread or process in Symbian platform can request services from |
|
16 another.</p> <p>Client programs typically use these idioms when accessing |
|
17 system services such as windowing, or telephony. This process is so fundamental |
|
18 that the basic structure of nearly all Symbian platform applications is based |
|
19 on its encapsulation in the active object framework.</p> </section> |
|
20 <section id="GUID-CA918B24-FFC7-47C1-A683-F8AE01192ED3"><title>Architectural relationships</title> <p>Asynchronous services |
|
21 are used throughout Symbian platform, most commonly as encapsulated in the |
|
22 client/server architecture. Some APIs may in turn wrap client/server relationships |
|
23 in framework classes, so that it is not immediately obvious that a client |
|
24 program is using asynchronous services. The most important case of this is |
|
25 the UI application framework, which wraps client requests to be informed of |
|
26 user interface events.</p> </section> |
|
27 <section id="GUID-78BD76F0-7785-4238-A17F-40B7117BEB39"><title>Description</title> <p><b>General |
|
28 properties</b> </p> <p>Client programs must often request access to services |
|
29 provided by other threads or processes. For example, most application programs |
|
30 will request the system's window server process to inform it of keyboard input. |
|
31 A thread or process that provides such services is called an <i>asynchronous |
|
32 service provider</i>.</p> <p>When a function call to an asynchronous service |
|
33 provider returns, it means only that the request has been despatched. The |
|
34 asynchronous service provider informs the requester that it has actually completed |
|
35 the request through a signalling mechanism.</p> <ul> |
|
36 <li id="GUID-E6B20563-4114-5896-A80E-1D2195631346"><p>Low-level asynchronous |
|
37 service handling shows the basic asynchronous services concepts.</p> </li> |
|
38 <li id="GUID-A84879C4-703D-5681-934D-D7649440A67F"><p>High-level asynchronous |
|
39 service handling shows the Symbian platform framework that encapsulates asynchronous |
|
40 service handling.</p> </li> |
|
41 </ul> <p><b>Low-level |
|
42 asynchronous service handling</b> </p> <p>Low-level asynchronous service handling |
|
43 has two key concepts, asynchronous request status, and thread request semaphore.</p> <p><b>Asynchronous request status</b> </p> <p>An asynchronous request status |
|
44 indicates the completion status of a request to a service provider. When a |
|
45 thread makes a request, it passes an asynchronous request status as a parameter. |
|
46 When the provider completes the request, it stores a success or error code |
|
47 in the request status.</p> <p>The asynchronous request status is provided |
|
48 by <xref href="GUID-E0B34F3E-D4C4-3232-B8B1-7DB35B454646.dita"><apiname>TRequestStatus</apiname></xref>.</p> <p><b>Thread |
|
49 request semaphore</b> </p> <p>A thread request semaphore is the means by which |
|
50 a provider signals a requester that it has completed a request. Client code |
|
51 can then determine which request has completed, and call an appropriate function |
|
52 to handle completion of the request. </p> <p>Functions to signal a thread |
|
53 request semaphore, and to wait until it has been signalled are provided by |
|
54 the System Static Functions API <xref href="GUID-C197C9A7-EA05-3F24-9854-542E984C612D.dita"><apiname>User</apiname></xref> class.</p> <p><b>High-level asynchronous service handling</b> </p> <p>High-level asynchronous |
|
55 service handling has two key concepts, active object, and active scheduler.</p> <p><b>Active object</b> </p> <p>An active object encapsulates the general behavior |
|
56 of making requests to asynchronous service provider, and handling the completion |
|
57 of requests. Particular asynchronous service provider typically supply active |
|
58 object based classes as interfaces by which clients to access them. </p> <p>The |
|
59 active object interface is provided by <xref href="GUID-067293BF-B28C-3CEC-92F4-1351A795EA7F.dita"><apiname>CActive</apiname></xref>.</p> <p><b>Active scheduler</b> </p> <p>A thread which uses asynchronous services |
|
60 must have a main loop that waits on the thread’s request semaphore for any |
|
61 outstanding requests to complete. The active scheduler encapsulates this wait |
|
62 loop. An active scheduler is provided for all GUI programs. A high-level view |
|
63 of a GUI application is therefore is that it is a set of active objects to |
|
64 handle request completion events fed it by its active scheduler.</p> <p>The |
|
65 active scheduler interface is provided by <xref href="GUID-B4C76104-EA1B-3FC3-A31E-86A976598171.dita"><apiname>CActiveScheduler</apiname></xref>.</p> </section> |
|
66 <section id="GUID-67C2E21D-8F63-4637-832F-9EBD4B2FF4AF"><title>See also</title> <p><xref href="GUID-D0D27AEA-FDDB-5F6F-94F6-ADDF5910DC47.dita">Client/Server |
|
67 Overview</xref> </p> <p><xref href="GUID-E865E677-1219-500C-89CF-0A2835B91834.dita">Semaphores |
|
68 Overview</xref> </p> <p><xref href="GUID-FF8F5D97-7D37-5F6B-84A3-C064E2FD53E0.dita">System |
|
69 Static Functions Overview</xref> </p> </section> |
|
70 </conbody></concept> |