|
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-AAA2ABA4-5555-5E4B-AEFF-3DF61462B170" xml:lang="en"><title>Introduction |
|
13 to asynchronous programming</title><shortdesc>This document introduces the concept of asynchronous programming.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <p>When a program requests a service, this service can be performed either <i>synchronously</i> or <i>asynchronously</i>. </p> |
|
15 <p>A synchronous service is the normal pattern for function calls where the |
|
16 function returns and the service requested has either performed successfully |
|
17 or has failed and an error code returned.</p> |
|
18 <p>An asynchronous service is <i>requested</i> by a function call but completion |
|
19 occurs later. Completion is indicated by a <i>signal</i>. Between the issue |
|
20 of the request and the signal, the request is said to be <i>pending</i>. The |
|
21 requesting program can do other processing while the request is pending or |
|
22 it can issue a <i>wait</i>. The operating system wakes the program up when |
|
23 completion of any of its pending requests is signalled.</p> |
|
24 <p>A program may contain a number of independently-executing units, called |
|
25 threads. All programs have a primary thread, and may create other threads, |
|
26 possibly for providing or using asynchronous services.</p> |
|
27 <p>If all threads are in a wait state, for example, waiting for user input, |
|
28 Symbian platform powers down as much as possible of the machine’s electronics. |
|
29 This results in battery savings and, consequently, a considerable extension |
|
30 of useful battery life.</p> |
|
31 </conbody></concept> |