<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ CreateSemaphore</code>( [<var class="Arg">value</var>] )</td><td class="tdright">( function )</td></tr></table></div>
<p>The function <code class="func">CreateSemaphore</code> takes an optional argument, which defaults to zero. It is the counter with which the semaphore is initialized.</p>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ WaitSemaphore</code>( <var class="Arg">sem</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p><code class="func">WaitSemaphore</code> receives a previously created semaphore as its argument. If the semaphore's counter is greater than zero, it decrements the counter and returns; if the counter is zero, it waits until another thread increases it via SignalSemaphore (8.1-3), then decrements the counter and returns.
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ SignalSemaphore</code>( <var class="Arg">sem</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p><code class="func">SignalSemaphore</code> receives a previously created semaphore as its argument. It increments the semaphore's counter and returns.
<p>In order to use semaphores to simulate locks, create a semaphore with an initial value of 1. <code class="func">WaitSemaphore</code> (<a href="chap8_mj.html#X834E47327A3FC5A2"><span class="RefLink">8.1-2</span></a>) is then equivalent to a lock operation, <code class="func">SignalSemaphore</code> (<a href="chap8_mj.html#X7F0C1F1F8540CF8C"><span class="RefLink">8.1-3</span></a>) is equivalent to an unlock operation.</p>
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.20Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.