Symbian3/SDK/Source/GUID-E61A931D-6E66-5E17-AE61-ABFB74CB8EF2.dita
changeset 0 89d6a7a84779
equal deleted inserted replaced
-1:000000000000 0:89d6a7a84779
       
     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-E61A931D-6E66-5E17-AE61-ABFB74CB8EF2" xml:lang="en"><title>Life
       
    13 cycle of active objects</title><shortdesc>This document describes the life cycle of an active objet.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <p>The diagram illustrates the life-cycle of an active object. </p>
       
    15 <fig id="GUID-BF465AB5-B007-5F44-9AF7-DA0963AE3BDE">
       
    16 <title>Flow diagram showing the life cycle of an active object</title>
       
    17 <image href="GUID-36F18DC4-7BD0-59C6-95E9-8FD945B86D7E_d0e208547_href.png" placement="inline"/>
       
    18 </fig>
       
    19 <p>Procedural flow follows the black arrows; control is transferred along
       
    20 the blue links, as follows:</p>
       
    21 <ul>
       
    22 <li id="GUID-3E3558A3-8C64-515B-A024-81586B472985"><p>the main program creates
       
    23 and installs an active scheduler</p> </li>
       
    24 <li id="GUID-15AE6C3A-5CF7-5711-951A-6FFC8CB6ED27"><p>active objects are created;
       
    25 their constructors ensure that every active object is added to the active
       
    26 scheduler (which keeps a reference to the object in its queue)</p> </li>
       
    27 <li id="GUID-9428DF85-02A3-56C2-A145-604A0356A166"><p>an active object is
       
    28 called to issue an initial request. This sets the object's <codeph>iActive</codeph> true
       
    29 (indicating a request was issued but not yet completed) and schedules the
       
    30 underlying service, which sets the object's <codeph>iStatus</codeph> to <codeph>KRequestPending</codeph>.
       
    31 (If this step is omitted, no service will be requested, so no handler will
       
    32 be invoked and hence the active scheduler will wait forever in its loop, never
       
    33 calling any object's <codeph>RunL()</codeph>)</p> </li>
       
    34 <li id="GUID-48E77554-3EF4-5313-969A-12D3426DA502"><p>the active scheduler
       
    35 is started. This now takes over; control is only returned to the main program
       
    36 for termination when the active scheduler is stopped</p> </li>
       
    37 <li id="GUID-E697E0CF-65F0-5AFD-8201-ADC6A791D98C"><p>when a requested service
       
    38 completes, it's handler terminates by signaling service completion; this alters
       
    39 the associated active object's <codeph>iStatus</codeph> </p> </li>
       
    40 <li id="GUID-CDD9242D-9540-5DC0-A948-8914F2AEF905"><p>when any service handler
       
    41 signals completion, the active scheduler tests each object in its queues for
       
    42 one with <codeph>iActive</codeph> true (request not completed) and <codeph>iStatus</codeph> not
       
    43 set to <codeph>KRequestPending</codeph> (i.e. the request has been handled) </p> </li>
       
    44 <li id="GUID-98980800-03DA-5623-9305-94609FBE9788"><p>if the active scheduler
       
    45 finds an object with the above conditions, it sets <codeph>iActive</codeph> false
       
    46 and calls the object's <codeph>RunL()</codeph> </p> </li>
       
    47 <li id="GUID-CFC4609C-3FED-538E-9555-1A90114876A3"><p>the <codeph>RunL()</codeph> may
       
    48 reschedule the request (so that the handler is again invoked when the requested
       
    49 service completes and the cycle continues.) or may stop the active scheduler,
       
    50 returning control to the main program for termination.</p> </li>
       
    51 </ul>
       
    52 </conbody></concept>