Symbian3/SDK/Source/GUID-E865E677-1219-500C-89CF-0A2835B91834.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 21 Jan 2010 18:18:20 +0000
changeset 0 89d6a7a84779
permissions -rw-r--r--
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE concept
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept xml:lang="en" id="GUID-E865E677-1219-500C-89CF-0A2835B91834"><title>Semaphores Overview</title><prolog><metadata><keywords/></metadata></prolog><conbody><section><title>Purpose</title> <p>Synchronises co-operation between threads. </p> </section> <section><title>Architectural relationships</title> <p>Every thread in Symbian OS automatically has a semaphore called a <i>thread request semaphore</i>. It is the underlying mechanism by which a thread is put in a waiting state until an asynchronous request completes.</p> <p>The thread request semaphore is accessed through the System Static Functions API.</p> </section> <section><title>Description</title> <p>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).</p> <p>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.</p> <p>Semaphores are Kernel objects and, as such, are managed by the Kernel, and accessed by user programs through handles. </p> <p>The semaphore handle is provided by <xref href="GUID-AED27A76-3645-3A04-B80D-10473D9C5A27.dita"><apiname>RSemaphore</apiname></xref>.</p> <p><xref href="GUID-F3ACDC41-31EE-3C32-BE2C-D696B84931CD.dita"><apiname>TFindSemaphore</apiname></xref> is used for finding a semaphore created by another process.</p> </section> <section><title>See also</title> <p><xref href="GUID-1294F540-FDA7-5050-BAFB-3C9888491B98.dita">Asynchronous Services Overview</xref> </p> <p><xref href="GUID-FF8F5D97-7D37-5F6B-84A3-C064E2FD53E0.dita">System Static Functions Overview</xref> </p> </section> </conbody></concept>