Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]


Semaphores Overview

[Top]


Purpose

Synchronises co-operation between threads.

[Top]


Architectural relationships

Every thread in Symbian OS automatically has a semaphore called a thread request semaphore. It is the underlying mechanism by which a thread is put in a waiting state until an asynchronous request completes.

The thread request semaphore is accessed through the System Static Functions API.

[Top]


Description

A semaphore restricts the number of simultaneous users of a shared resource up to a maximum number. Threads can request access to the resource (decrementing the semaphore), and can signal that they have finished using the resource (incrementing the semaphore).

A thread that requests access to a busy resource is put in a waiting state. The semaphore maintains a FIFO queue of such waiting threads. When another thread increments the semaphore, the first thread in this queue is resumed.

Semaphores are Kernel objects and, as such, are managed by the Kernel, and accessed by user programs through handles.

The semaphore handle is provided by RSemaphore.

TFindSemaphore is used for finding a semaphore created by another process.

[Top]


See also

Asynchronous Services Overview

System Static Functions Overview