Symbian3/SDK/Source/GUID-3DE276E8-D2C7-5297-AF3B-40B0B8733572.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Fri, 13 Aug 2010 16:47:46 +0100
changeset 14 578be2adaf3e
parent 13 48780e181b38
permissions -rw-r--r--
Week 32 contribution of PDK documentation content. See release notes for details. Fixes bug Bug 3582

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-3DE276E8-D2C7-5297-AF3B-40B0B8733572" xml:lang="en"><title>Inter-thread
Data Transfer</title><shortdesc>The mechanism for copying data between threads is called inter-thread
data transfer and is handled by the four functions provided by the <codeph>RThread</codeph> handle.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>Data can be passed between threads. The threads can be in the same process
or in different processes. The functions provides by the <xref href="GUID-B0E661BC-4058-3256-B9C3-5A4FD52F6DE5.dita"><apiname>RThread</apiname></xref> class
are:</p>
<ul>
<li id="GUID-416730EC-5719-5633-A51A-50B0E3AAD8F4"><p><codeph>ReadL()</codeph> </p> </li>
<li id="GUID-B4EF1893-D469-541A-898E-AEC8DBF1BD3A"><p><codeph>WriteL()</codeph> </p> </li>
<li id="GUID-7550CBE4-FEBF-51E5-AB0D-80729D7CAC95"><p><codeph>GetDesLength()</codeph> </p> </li>
<li id="GUID-0B8127FB-9FE1-5EAA-9B8B-3F0BC9F4AAF5"><p><codeph>GetDesMaxLength()</codeph> </p> </li>
</ul>
<p>The functions are used in the implementation of the <codeph>RMessage</codeph> class
which, in turn, is used for passing information between clients and servers.</p>
<p>The <codeph>ReadL()</codeph> and <codeph>WriteL()</codeph> functions, which
transfer data, assume that both source and target data are descriptors.</p>
<p>Typically, code executing in the current thread will have a handle to another
thread. The code in the <i>current</i> thread copies data <i>from</i> the <i>other</i> thread,
represented by an <codeph>RThread</codeph> handle, by calling its <codeph>ReadL()</codeph> function.
Copying data <i>to</i> the <i>other</i> thread is similar, but is done using
the <codeph>WriteL()</codeph> function. The following diagram illustrates
this:</p>
<fig id="GUID-7A4E3725-E6DA-566D-86E0-2941A8D96ACE">
<image href="GUID-40C995CA-9906-59D8-A5E7-08F592031AEE_d0e252896_href.png" placement="inline"/>
</fig>
<p>The source or target location in the <i>other</i> thread is identified
by pointer. The pointer only has meaning within the context of that thread;
attempting to reference the pointer directly from within the <i>current</i> thread
is meaningless and may cause an exception.</p>
</conbody></concept>