Semaphores Overview

This document provides an overview of semaphores.


Synchronises co-operation between threads.

Architectural relationships

Every thread in Symbian platform 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.


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.