Symbian3/SDK/Source/GUID-E651C7A7-D6EB-533E-A97A-360D089DE7A5.dita
changeset 7 51a74ef9ed63
child 8 ae94777fff8f
equal deleted inserted replaced
6:43e37759235e 7:51a74ef9ed63
       
     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-E651C7A7-D6EB-533E-A97A-360D089DE7A5" xml:lang="en"><title>Inter-thread
       
    13 data transfer</title><shortdesc>Describes how data is transferred between threads.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <p>The client-server message protocol supports the passing of a 32-bit request
       
    15 code and four 32-bit parameters from client to server and returning a 32-bit
       
    16 result from the server to the client. The parameters may be interpreted as
       
    17 plain integers or pointers; pointer types may be untyped (<codeph>TAny*</codeph>)
       
    18 or descriptor types (<codeph>TDesC8*</codeph> and <codeph>TDesC16*</codeph>)
       
    19 that the server can use to access the client’s address space. The request
       
    20 code, parameters, and the parameter types are packaged into a <xref href="GUID-4AD02F14-1142-372F-9D11-224595932034.dita"><apiname>TIpcArgs</apiname></xref> object.
       
    21 The parameter types are stored in the kernel side message object so that the
       
    22 kernel can check that subsequent operations requested by the server using
       
    23 the message are: </p>
       
    24 <ul>
       
    25 <li id="GUID-1F925301-81D0-5F84-ABEE-BB4DB576DBC1"><p>correct; for example,
       
    26 checking that the source and target descriptors are either both 8-bit or both
       
    27 16-bit descriptors </p> </li>
       
    28 <li id="GUID-EE7CCC5F-0013-55EA-B473-763785F5CD90"><p>permitted by the client;
       
    29 for example, checking that when the server tries to write to a client descriptor,
       
    30 that the client descriptor is <xref href="GUID-49D4E917-57EA-39AE-8941-144AA8AC2584.dita"><apiname>TDes</apiname></xref> -derived (modifiable),
       
    31 rather than <xref href="GUID-52D07F46-2162-380C-A775-C3BB335C42F5.dita"><apiname>TDesC</apiname></xref> -derived (non-modifiable) </p> </li>
       
    32 </ul>
       
    33 <p><note>NOTE:</note> although you can pass untyped pointers, it is not possible
       
    34 to directly access memory in another thread’s address space using an arbitrary
       
    35 pointer as this is inherently insecure. The ability to pass a pointer between
       
    36 a client and server is therefore only of value when the client and server
       
    37 are within the same process. In this case, the use of a pointer is obviously
       
    38 not limited to pointing to a descriptor, but may also be used to point to
       
    39 an arbitrary data structure containing information to be shared between the
       
    40 client and server. </p>
       
    41 <p>It is important to note that a server may not run until some arbitrary
       
    42 time after a client issues a request. Any descriptor containing data to be
       
    43 passed to the server must be guaranteed to exist until the request completes.
       
    44 For this reason, any such descriptor must <i>not</i> live on the program stack.
       
    45 Typically, such a descriptor would be a component of an object which is allocated
       
    46 on the heap. </p>
       
    47 <p>The following diagram illustrates the general idea. In this case, there
       
    48 are three parameters, one of which is an integer, and the other two being
       
    49 pointers to descriptors. </p>
       
    50 <fig id="GUID-C3369B01-2A0D-5AB2-973B-386FDBBB6B86">
       
    51 <image href="GUID-2105B5F0-2D00-5ECA-8859-A8A432423327_d0e241065_href.png" placement="inline"/>
       
    52 <p>Inter-thread data transfer</p>
       
    53 </fig>
       
    54 <section id="GUID-EE636E39-A171-484D-AAF4-7996D04C8EEC"><title>See also</title> <p> <xref href="GUID-79BAF19D-F003-5468-9C01-6E918B06C36D.dita">Descriptor
       
    55 concepts</xref>. </p> </section>
       
    56 </conbody></concept>