<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>The SyncSemaphore class</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="syncmutex.unlock.html">SyncMutex::unlock</a></div> <div class="next" style="text-align: right; float: right;"><a href="syncsemaphore.construct.html">SyncSemaphore::__construct</a></div> <div class="up"><a href="book.sync.html">Sync</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="class.syncsemaphore" class="reference"> <h1 class="title">The SyncSemaphore class</h1> <div class="partintro"><p class="verinfo">(PECL sync >= 1.0.0)</p> <div class="section" id="syncsemaphore.intro"> <h2 class="title">Introduction</h2> <p class="para"> A cross-platform, native implementation of named and unnamed sempahore objects. </p> <p class="para"> A semaphore restricts access to a limited resource to a limited number of instances. Semaphores differ from mutexes in that they can allow more than one instance to access a resource at one time while a mutex only allows one instance at a time. </p> </div> <div class="section" id="syncsemaphore.synopsis"> <h2 class="title">Class synopsis</h2> <div class="classsynopsis"> <div class="ooclass"></div> <div class="classsynopsisinfo"> <span class="ooclass"> <strong class="classname">SyncSemaphore</strong> </span> {</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methods */</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="methodname"><a href="syncsemaphore.construct.html" class="methodname">__construct</a></span> ([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span> [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$initialval</code><span class="initializer"> = 1</span></span> [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$autounlock</code><span class="initializer"> = <strong><code>TRUE</code></strong></span></span> ]]] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="syncsemaphore.lock.html" class="methodname">lock</a></span> ([ <span class="methodparam"><span class="type">int</span> <code class="parameter">$wait</code><span class="initializer"> = -1</span></span> ] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="syncsemaphore.unlock.html" class="methodname">unlock</a></span> ([ <span class="methodparam"><span class="type">int</span> <code class="parameter reference">&$prevcount</code></span> ] )</div> }</div> </div> </div> <h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="syncsemaphore.construct.html">SyncSemaphore::__construct</a> — Constructs a new SyncSemaphore object</li><li><a href="syncsemaphore.lock.html">SyncSemaphore::lock</a> — Decreases the count of the semaphore or waits</li><li><a href="syncsemaphore.unlock.html">SyncSemaphore::unlock</a> — Increases the count of the semaphore</li></ul> </div> <hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="syncmutex.unlock.html">SyncMutex::unlock</a></div> <div class="next" style="text-align: right; float: right;"><a href="syncsemaphore.construct.html">SyncSemaphore::__construct</a></div> <div class="up"><a href="book.sync.html">Sync</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>