<!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>Destroy Mutex</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mutex.create.html">Mutex::create</a></div> <div class="next" style="text-align: right; float: right;"><a href="mutex.lock.html">Mutex::lock</a></div> <div class="up"><a href="class.mutex.html">Mutex</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="mutex.destroy" class="refentry"> <div class="refnamediv"> <h1 class="refname">Mutex::destroy</h1> <p class="verinfo">(PECL pthreads >= 0.34)</p><p class="refpurpose"><span class="refname">Mutex::destroy</span> — <span class="dc-title">Destroy Mutex</span></p> </div> <div class="refsect1 description" id="refsect1-mutex.destroy-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="modifier">final</span> <span class="modifier">public</span> <span class="modifier">static</span> <span class="type">boolean</span> <span class="methodname"><strong>Mutex::destroy</strong></span> ( <span class="methodparam"> <span class="type"><span class="type long">long</span></span> <code class="parameter">$mutex</code> </span> )</div> <p class="para rdfs-comment">Destroying Mutex handles must be carried out explicitly by the programmer when they are finished with the Mutex handle. </p> </div> <div class="refsect1 parameters" id="refsect1-mutex.destroy-parameters"> <h3 class="title">Parameters</h3> <dl> <dt> <span class="term"><em><code class="parameter">mutex</code></em></span> <dd> <p class="para"> A handle returned by a previous call to <span class="function"><a href="mutex.create.html" class="function">Mutex::create()</a></span>. The handle should not be locked by any Thread when <span class="function"><strong>Mutex::destroy()</strong></span> is called. </p> </dd> </dt> </dl> </div> <div class="refsect1 returnvalues" id="refsect1-mutex.destroy-returnvalues"> <h3 class="title">Return Values</h3> <p class="para">A boolean indication of success</p> </div> <div class="refsect1 returnvalues" id="refsect1-mutex.destroy-returnvalues"> <h3 class="title">Return Values</h3> <p class="para">A newly created and optionally locked Mutex handle</p> </div> <div class="refsect1 examples" id="refsect1-mutex.destroy-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-3712"> <p><strong>Example #1 Mutex Creation and Destruction</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">/** You cannot use the "new" keyword, a Mutex is not a PHP object **/<br /></span><span style="color: #0000BB">$mutex </span><span style="color: #007700">= </span><span style="color: #0000BB">Mutex</span><span style="color: #007700">::</span><span style="color: #0000BB">create</span><span style="color: #007700">();<br /></span><span style="color: #FF8000">/** You have the physical address of the Mutex **/<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$mutex</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">/** Always destroy mutex you have created **/<br /></span><span style="color: #0000BB">Mutex</span><span style="color: #007700">::</span><span style="color: #0000BB">destroy</span><span style="color: #007700">(</span><span style="color: #0000BB">$mutex</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <div class="example-contents"><p>The above example will output:</p></div> <div class="example-contents screen"> <div class="cdata"><pre> int(40096976) </pre></div> </div> </div> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="mutex.create.html">Mutex::create</a></div> <div class="next" style="text-align: right; float: right;"><a href="mutex.lock.html">Mutex::lock</a></div> <div class="up"><a href="class.mutex.html">Mutex</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>