|
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-3DE276E8-D2C7-5297-AF3B-40B0B8733572" xml:lang="en"><title>Inter-thread |
|
13 Data Transfer</title><shortdesc>The mechanism for copying data between threads is called inter-thread |
|
14 data transfer and is handled by the four functions provided by the <codeph>RThread</codeph> handle.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
15 <p>Data can be passed between threads. The threads can be in the same process |
|
16 or in different processes. The functions provides by the <xref href="GUID-B0E661BC-4058-3256-B9C3-5A4FD52F6DE5.dita"><apiname>RThread</apiname></xref> class |
|
17 are:</p> |
|
18 <ul> |
|
19 <li id="GUID-416730EC-5719-5633-A51A-50B0E3AAD8F4"><p><codeph>ReadL()</codeph> </p> </li> |
|
20 <li id="GUID-B4EF1893-D469-541A-898E-AEC8DBF1BD3A"><p><codeph>WriteL()</codeph> </p> </li> |
|
21 <li id="GUID-7550CBE4-FEBF-51E5-AB0D-80729D7CAC95"><p><codeph>GetDesLength()</codeph> </p> </li> |
|
22 <li id="GUID-0B8127FB-9FE1-5EAA-9B8B-3F0BC9F4AAF5"><p><codeph>GetDesMaxLength()</codeph> </p> </li> |
|
23 </ul> |
|
24 <p>The functions are used in the implementation of the <codeph>RMessage</codeph> class |
|
25 which, in turn, is used for passing information between clients and servers.</p> |
|
26 <p>The <codeph>ReadL()</codeph> and <codeph>WriteL()</codeph> functions, which |
|
27 transfer data, assume that both source and target data are descriptors.</p> |
|
28 <p>Typically, code executing in the current thread will have a handle to another |
|
29 thread. The code in the <i>current</i> thread copies data <i>from</i> the <i>other</i> thread, |
|
30 represented by an <codeph>RThread</codeph> handle, by calling its <codeph>ReadL()</codeph> function. |
|
31 Copying data <i>to</i> the <i>other</i> thread is similar, but is done using |
|
32 the <codeph>WriteL()</codeph> function. The following diagram illustrates |
|
33 this:</p> |
|
34 <fig id="GUID-7A4E3725-E6DA-566D-86E0-2941A8D96ACE"> |
|
35 <image href="GUID-40C995CA-9906-59D8-A5E7-08F592031AEE_d0e223038_href.png" placement="inline"/> |
|
36 </fig> |
|
37 <p>The source or target location in the <i>other</i> thread is identified |
|
38 by pointer. The pointer only has meaning within the context of that thread; |
|
39 attempting to reference the pointer directly from within the <i>current</i> thread |
|
40 is meaningless and may cause an exception.</p> |
|
41 </conbody></concept> |