diff -r 43e37759235e -r 51a74ef9ed63 Symbian3/SDK/Source/GUID-092C18D4-A525-5562-9BF6-41435E400290.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-092C18D4-A525-5562-9BF6-41435E400290.dita Wed Mar 31 11:11:55 2010 +0100 @@ -0,0 +1,41 @@ + + + + + +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 +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 +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 +the code.

+
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 +on the emulator you are using, you may need to navigate away from the application +launcher or shell screen to view the console.

+
\ No newline at end of file