This document provides an overview of threads and processes.
Provides access to processes, threads, and thread-local storage.
Processes are usually only manipulated directly by system programs. Threads can be directly manipulated by multi-threaded programs. Note however that the active objects framework provided by the Asynchronous Services API is usually preferred to multi-threading in Symbian platform programming.
The API has three key concepts: process, thread, and thread-local storage.
Process
A program running in Symbian platform is a process, which can contains one or more conceptually concurrent threads of execution. Each user process has its own private address space. A process can create another process.
Processes are Kernel objects and so are accessed by user programs through handles.
The process handle interface is provided by RProcess.
TFindProcess is used for finding another process.
Thread
A thread is the unit of execution within a process. The scheduling of threads is pre-emptive, i.e. a currently executing thread may be suspended at any time to allow another thread to run.
Note the following properties of threads:
every process has a primary thread that is created when the process is initialised
a thread can create, suspend, resume, panic and kill other threads, subject to protection
data can be passed between threads whether those threads are in different processes or the same process
each thread has a priority: the scheduler runs the highest-priority thread that is ready to run
Threads are Kernel objects and so are accessed by user programs through handles.
The thread handle interface is provided by RThread.
TFindThread is used for finding another thread.
The System Static Functions API User class provides a number of functions that operate on the current thread.
Thread-local storage
Thread-local storage in Symbian platform supports one machine word of static data per DLL per thread. The scope of the word is the thread and is only accessible to DLL code. DLL code running on behalf of one thread does not see the same word when running on behalf of another thread.
The thread-local storage interface is provided by Dll.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.