diff -r 25a17d01db0c -r ebc84c812384 Symbian3/SDK/Source/GUID-092C18D4-A525-5562-9BF6-41435E400290.dita --- a/Symbian3/SDK/Source/GUID-092C18D4-A525-5562-9BF6-41435E400290.dita Fri Jan 22 18:26:19 2010 +0000 +++ b/Symbian3/SDK/Source/GUID-092C18D4-A525-5562-9BF6-41435E400290.dita Thu Mar 11 15:24:26 2010 +0000 @@ -12,26 +12,27 @@ LibpThread Example - Using P.I.P.S OECORE

This example application shows, using a P.I.P.S. (P.I.P.S. Is POSIX on -Symbian OS) program, the use of the LibpThread library to demonstrate simple -multi-threading and synchronisation.

+the Symbian platform) program, the use of the LibpThread library to demonstrate +simple multi-threading and synchronisation.

The purpose is to create a basic multithreading example showing the usage of the LibpThread APIs. This example also shows how multi-threading is used to achieve concurrency in tasks and sharing of resources.

-
Download

Click +

Download

Click on the following link to download the example: LibpThreadExample.zip

Click: browse to view the example code.

-
Description

The following sections provide more -information about the steps that the example performs.

Thread -Synchronisation

The example creates three threads named ThreadOne, -ThreadTwo and ThreadThree. The threads write "One", "Two" and "Three" five -times in a text file. The text file, located in epoc32\winscw\c\newfile.txt, -is used as a shared resource for all three threads. A mutex is used to ensure -that first ThreadOne writes in the file, then ThreadTwo and then ThreadThree. -If the mutex is not used all the threads can simultaneously write in the file. -This can be seen by commenting out pthread_mutex_lock and pthread_mutex_unlock in +

Description

The +following sections provide more information about the steps that the example +performs.

Thread Synchronisation

The example creates +three threads named ThreadOne, ThreadTwo and ThreadThree. The threads write +"One", "Two" and "Three" five times in a text file. The text file, located +in epoc32\winscw\c\newfile.txt, is used as a shared resource +for all three threads. A mutex is used to ensure that first ThreadOne writes +in the file, then ThreadTwo and then ThreadThree. If the mutex is not used +all the threads can simultaneously write in the file. This can be seen by +commenting out pthread_mutex_lock and pthread_mutex_unlock in the code.

-
Related APIs

pthread_mutex_lock

pthread_mutex_unlock

pthread_join

pthread_mutex_t

-
Build

The Symbian -OS build process describes how to build this example application.

The +

Related APIs

pthread_mutex_lock

pthread_mutex_unlock

pthread_join

pthread_mutex_t

+
Build

The Symbian build +process describes how to build this example application.

The example builds an executable called LibpThreadExample.exe in the standard locations.

To run the example, start LibpThreadExample.exe from the file system or from your IDE. After launching the executable, depending