Symbian3/PDK/Source/GUID-24477051-265A-5FE5-B479-ACB3EE27B825.dita
changeset 3 46218c8b8afa
parent 1 25a17d01db0c
child 5 f345bda72bc4
--- a/Symbian3/PDK/Source/GUID-24477051-265A-5FE5-B479-ACB3EE27B825.dita	Thu Mar 11 15:24:26 2010 +0000
+++ b/Symbian3/PDK/Source/GUID-24477051-265A-5FE5-B479-ACB3EE27B825.dita	Thu Mar 11 18:02:22 2010 +0000
@@ -1,83 +1,83 @@
-<?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-24477051-265A-5FE5-B479-ACB3EE27B825" xml:lang="en"><title>Synchronisation
-techniques</title><prolog><metadata><keywords/></metadata></prolog><conbody>
-<p>There are a number of techniques to synchronise or coordinate the activities
-of your threads with one another: </p>
-<ul>
-<li id="GUID-E5EC8F8C-2129-5750-AFDC-F4B15E3874C9"><p> <xref href="GUID-24477051-265A-5FE5-B479-ACB3EE27B825.dita#GUID-24477051-265A-5FE5-B479-ACB3EE27B825/GUID-68FCE30C-5487-501E-842C-6895717FD636">Thread Rendezvous</xref> </p> </li>
-</ul>
-<section id="GUID-68FCE30C-5487-501E-842C-6895717FD636"><title>Thread Rendezvous</title> <p>The <xref href="GUID-B0E661BC-4058-3256-B9C3-5A4FD52F6DE5.dita#GUID-B0E661BC-4058-3256-B9C3-5A4FD52F6DE5/GUID-83AADCC6-1AD8-32D8-A6E6-B86B47C97DC2"><apiname>RThread::Rendezvous()</apiname></xref> function
-allows a thread to signal that it has reached a point in its execution. This
-works in a similar way to the <xref href="GUID-77B673ED-F7EE-3D50-88A7-F8FBFCB2D64E.dita"><apiname>Logon()</apiname></xref> function, except
-that <xref href="GUID-77B673ED-F7EE-3D50-88A7-F8FBFCB2D64E.dita"><apiname>Logon()</apiname></xref> signals the termination of a thread, and <xref href="GUID-45C22917-DC6E-3C95-BFE5-B8E9B316D4E3.dita"><apiname>Rendezvous()</apiname></xref> signals
-that a particular point within the thread has been reached. </p> <p>The classic
-use for this function is in a server, where the main thread must wait until
-the initialisation of the server thread has completed before continuing. </p> <p><b>Using Rendezvous</b> </p> <p>The following example shows code a function
-creating a thread and then waiting for it to reach a certain point before
-continuing. The code shown here is taken from <filepath>…\examples\base\threadsandprocesses\Rendezvous\</filepath>,
-which you can build and run. </p> <codeblock id="GUID-292F2672-390D-5D14-9615-8894315A1645" xml:space="preserve">      // create threads to wait for
-    RThread thread;
-
-        // indicate completion status
-    TRequestStatus myThreadRendezvousStatus;
-
-        // pass 500 as the parameter to MyThread        
-    TInt r=thread.Create(KMsgMyThreadName, MyThread, KDefaultStackSize, KHeapSize,KHeapSize,(TAny*) 2000000, EOwnerThread); 
-    if (r!=KErrNone)
-        {   
-        console-&gt;Printf(KMsgCreateThreadFailed);
-            return;
-        }
-        // create rendezvous
-    thread.Rendezvous(myThreadRendezvousStatus);
-
-        //EXCECUTE THREAD!
-    console-&gt;Printf(KMsgStartThread);                    
-    thread.Resume();
-
-    User::WaitForRequest(myThreadRendezvousStatus);
-    if(myThreadRendezvousStatus==KErrNone)
-        {
-        console-&gt;Printf(KMsgThreadRendezvousReached);
-        }
-        else
-        {
-        console-&gt;Printf(KMsgSomethingIsWrong);   
-        }   
-        
-    thread.Close();
-    console-&gt;Printf(KMsgEndOfTest);</codeblock> <p>The following function
-is the <codeph>MyThread()</codeph> function created in the previous example.
-The <codeph>MyThread()</codeph> function calls the rendezvous function to
-signal that the rendezvous point has been reached, <codeph>MyThread()</codeph> can
-then continue. </p> <codeblock id="GUID-94F0244E-B3E8-54F0-9BD8-6BB8942BA30F" xml:space="preserve">TInt MyThread(TAny* aParameter)
-    {
-        // simulate some processing
-    User::After((TInt)aParameter);      
-            
-            // signal Rendezvous
-    RThread::Rendezvous(KErrNone);
-    
-        // simulate some processing
-    User::After((TInt)aParameter);      
-    
-    return(KErrNone);
-    }</codeblock> <p> <b>Note</b>: <codeph>MyThread()</codeph> can fail before
-signalling the <xref href="GUID-8BF63A5C-3A1D-3DBE-8120-9D7792D65B86.dita"><apiname>rendezvous</apiname></xref>, for example, if <codeph>MyThread()</codeph> panics
-with a KERN-EXEC 3, then the <xref href="GUID-8BF63A5C-3A1D-3DBE-8120-9D7792D65B86.dita"><apiname>rendezvous</apiname></xref> completes with
-the reason code <codeph>KErrDied</codeph> or another system wide error code
-other than <codeph>KErrNone</codeph>. </p><p>If &lt;code&gt;MyThread()&lt;/code&gt;
-enters a never ending loop before the rendezvous is reached, then this situation
-cannot be detected and results in the calling thread waiting indefinitely
-for the rendezvous. This can be avoided by careful programming. </p> </section>
+<?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-24477051-265A-5FE5-B479-ACB3EE27B825" xml:lang="en"><title>Synchronisation
+techniques</title><prolog><metadata><keywords/></metadata></prolog><conbody>
+<p>There are a number of techniques to synchronise or coordinate the activities
+of your threads with one another: </p>
+<ul>
+<li id="GUID-E5EC8F8C-2129-5750-AFDC-F4B15E3874C9"><p> <xref href="GUID-24477051-265A-5FE5-B479-ACB3EE27B825.dita#GUID-24477051-265A-5FE5-B479-ACB3EE27B825/GUID-68FCE30C-5487-501E-842C-6895717FD636">Thread Rendezvous</xref> </p> </li>
+</ul>
+<section id="GUID-68FCE30C-5487-501E-842C-6895717FD636"><title>Thread Rendezvous</title> <p>The <xref href="GUID-B0E661BC-4058-3256-B9C3-5A4FD52F6DE5.dita#GUID-B0E661BC-4058-3256-B9C3-5A4FD52F6DE5/GUID-83AADCC6-1AD8-32D8-A6E6-B86B47C97DC2"><apiname>RThread::Rendezvous()</apiname></xref> function
+allows a thread to signal that it has reached a point in its execution. This
+works in a similar way to the <xref href="GUID-77B673ED-F7EE-3D50-88A7-F8FBFCB2D64E.dita"><apiname>Logon()</apiname></xref> function, except
+that <xref href="GUID-77B673ED-F7EE-3D50-88A7-F8FBFCB2D64E.dita"><apiname>Logon()</apiname></xref> signals the termination of a thread, and <xref href="GUID-45C22917-DC6E-3C95-BFE5-B8E9B316D4E3.dita"><apiname>Rendezvous()</apiname></xref> signals
+that a particular point within the thread has been reached. </p> <p>The classic
+use for this function is in a server, where the main thread must wait until
+the initialisation of the server thread has completed before continuing. </p> <p><b>Using Rendezvous</b> </p> <p>The following example shows code a function
+creating a thread and then waiting for it to reach a certain point before
+continuing. The code shown here is taken from <filepath>…\examples\base\threadsandprocesses\Rendezvous\</filepath>,
+which you can build and run. </p> <codeblock id="GUID-292F2672-390D-5D14-9615-8894315A1645" xml:space="preserve">      // create threads to wait for
+    RThread thread;
+
+        // indicate completion status
+    TRequestStatus myThreadRendezvousStatus;
+
+        // pass 500 as the parameter to MyThread        
+    TInt r=thread.Create(KMsgMyThreadName, MyThread, KDefaultStackSize, KHeapSize,KHeapSize,(TAny*) 2000000, EOwnerThread); 
+    if (r!=KErrNone)
+        {   
+        console-&gt;Printf(KMsgCreateThreadFailed);
+            return;
+        }
+        // create rendezvous
+    thread.Rendezvous(myThreadRendezvousStatus);
+
+        //EXCECUTE THREAD!
+    console-&gt;Printf(KMsgStartThread);                    
+    thread.Resume();
+
+    User::WaitForRequest(myThreadRendezvousStatus);
+    if(myThreadRendezvousStatus==KErrNone)
+        {
+        console-&gt;Printf(KMsgThreadRendezvousReached);
+        }
+        else
+        {
+        console-&gt;Printf(KMsgSomethingIsWrong);   
+        }   
+        
+    thread.Close();
+    console-&gt;Printf(KMsgEndOfTest);</codeblock> <p>The following function
+is the <codeph>MyThread()</codeph> function created in the previous example.
+The <codeph>MyThread()</codeph> function calls the rendezvous function to
+signal that the rendezvous point has been reached, <codeph>MyThread()</codeph> can
+then continue. </p> <codeblock id="GUID-94F0244E-B3E8-54F0-9BD8-6BB8942BA30F" xml:space="preserve">TInt MyThread(TAny* aParameter)
+    {
+        // simulate some processing
+    User::After((TInt)aParameter);      
+            
+            // signal Rendezvous
+    RThread::Rendezvous(KErrNone);
+    
+        // simulate some processing
+    User::After((TInt)aParameter);      
+    
+    return(KErrNone);
+    }</codeblock> <p> <b>Note</b>: <codeph>MyThread()</codeph> can fail before
+signalling the <xref href="GUID-8BF63A5C-3A1D-3DBE-8120-9D7792D65B86.dita"><apiname>rendezvous</apiname></xref>, for example, if <codeph>MyThread()</codeph> panics
+with a KERN-EXEC 3, then the <xref href="GUID-8BF63A5C-3A1D-3DBE-8120-9D7792D65B86.dita"><apiname>rendezvous</apiname></xref> completes with
+the reason code <codeph>KErrDied</codeph> or another system wide error code
+other than <codeph>KErrNone</codeph>. </p><p>If &lt;code&gt;MyThread()&lt;/code&gt;
+enters a never ending loop before the rendezvous is reached, then this situation
+cannot be detected and results in the calling thread waiting indefinitely
+for the rendezvous. This can be avoided by careful programming. </p> </section>
 </conbody></concept>
\ No newline at end of file