7 Nokia Corporation - initial contribution. |
7 Nokia Corporation - initial contribution. |
8 Contributors: |
8 Contributors: |
9 --> |
9 --> |
10 <!DOCTYPE concept |
10 <!DOCTYPE concept |
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
12 <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> |
12 <concept id="GUID-E865E677-1219-500C-89CF-0A2835B91834" xml:lang="en"><title>Semaphores |
|
13 Overview</title><shortdesc>This document provides an overview of semaphores.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
|
14 <section id="GUID-AFC30B0D-2A45-44D9-90BB-0D8D33455873"><title>Purpose</title> <p>Synchronises co-operation between threads. </p> </section> |
|
15 <section id="GUID-10F7B1B1-86CC-4877-AE42-E7D219D24183"><title>Architectural relationships</title> <p>Every thread in Symbian |
|
16 platform automatically has a semaphore called a <i>thread request semaphore</i>. |
|
17 It is the underlying mechanism by which a thread is put in a waiting state |
|
18 until an asynchronous request completes.</p> <p>The thread request semaphore |
|
19 is accessed through the System Static Functions API.</p> </section> |
|
20 <section id="GUID-EE14DA53-A4E9-40EE-9384-9A626F7C7C57"><title>Description</title> <p>A semaphore restricts the number of |
|
21 simultaneous users of a shared resource up to a maximum number. Threads can |
|
22 request access to the resource (decrementing the semaphore), and can signal |
|
23 that they have finished using the resource (incrementing the semaphore).</p> <p>A |
|
24 thread that requests access to a busy resource is put in a waiting state. |
|
25 The semaphore maintains a FIFO queue of such waiting threads. When another |
|
26 thread increments the semaphore, the first thread in this queue is resumed.</p> <p>Semaphores |
|
27 are Kernel objects and, as such, are managed by the Kernel, and accessed by |
|
28 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> |
|
29 <section id="GUID-774B1B01-7034-4462-B1C2-86BC22A62557"><title>See also</title> <p><xref href="GUID-1294F540-FDA7-5050-BAFB-3C9888491B98.dita">Asynchronous |
|
30 Services Overview</xref> </p> <p><xref href="GUID-FF8F5D97-7D37-5F6B-84A3-C064E2FD53E0.dita">System |
|
31 Static Functions Overview</xref> </p> </section> |
|
32 </conbody></concept> |