<!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 Threaded class</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="pthreads.constants.html">Predefined Constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="threaded.chunk.html">Threaded::chunk</a></div> <div class="up"><a href="book.pthreads.html">pthreads</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="class.threaded" class="reference"> <h1 class="title">The Threaded class</h1> <div class="partintro"><p class="verinfo">(PECL pthreads >= 2.0.0)</p> <div class="section" id="threaded.intro"> <h2 class="title">Introduction</h2> <p class="para"> Threaded objects form the basis of pthreads ability to execute user code in parallel; they expose synchronization methods and various useful interfaces. </p> <p class="para"> Threaded objects, most importantly, provide implicit safety for the programmer; all operations on the object scope are safe. </p> </div> <div class="section" id="threaded.synopsis"> <h2 class="title">Class synopsis</h2> <div class="classsynopsis"> <div class="ooclass"></div> <div class="classsynopsisinfo"> <span class="ooclass"> <strong class="classname">Threaded</strong> </span> <span class="oointerface">implements <span class="interfacename"><a href="class.collectable.html" class="interfacename">Collectable</a></span> </span> <span class="oointerface">, <span class="interfacename"><a href="class.traversable.html" class="interfacename">Traversable</a></span> </span> <span class="oointerface">, <span class="interfacename"><a href="class.countable.html" class="interfacename">Countable</a></span> </span> <span class="oointerface">, <span class="interfacename"><a href="class.arrayaccess.html" class="interfacename">ArrayAccess</a></span> </span> {</div> <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methods */</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">array</span> <span class="methodname"><a href="threaded.chunk.html" class="methodname">chunk</a></span> ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$size</code></span> , <span class="methodparam"><span class="type">bool</span> <code class="parameter">$preserve</code></span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">int</span> <span class="methodname"><a href="threaded.count.html" class="methodname">count</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="threaded.extend.html" class="methodname">extend</a></span> ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$class</code></span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">Threaded</span> <span class="methodname"><a href="threaded.from.html" class="methodname">from</a></span> ( <span class="methodparam"><span class="type"><a href="class.closure.html" class="type Closure">Closure</a></span> <code class="parameter">$run</code></span> [, <span class="methodparam"><span class="type"><a href="class.closure.html" class="type Closure">Closure</a></span> <code class="parameter">$construct</code></span> [, <span class="methodparam"><span class="type">array</span> <code class="parameter">$args</code></span> ]] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">array</span> <span class="methodname"><a href="threaded.getterminationinfo.html" class="methodname">getTerminationInfo</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="thread.isrunning.html" class="methodname">isRunning</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="threaded.isterminated.html" class="methodname">isTerminated</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="threaded.iswaiting.html" class="methodname">isWaiting</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="threaded.lock.html" class="methodname">lock</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="threaded.merge.html" class="methodname">merge</a></span> ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$from</code></span> [, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$overwrite</code></span> ] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="threaded.notify.html" class="methodname">notify</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="threaded.notifyone.html" class="methodname">notifyOne</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="threaded.pop.html" class="methodname">pop</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">void</span> <span class="methodname"><a href="threaded.run.html" class="methodname">run</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">mixed</span> <span class="methodname"><a href="threaded.shift.html" class="methodname">shift</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">mixed</span> <span class="methodname"><a href="threaded.synchronized.html" class="methodname">synchronized</a></span> ( <span class="methodparam"><span class="type"><a href="class.closure.html" class="type Closure">Closure</a></span> <code class="parameter">$block</code></span> [, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$...</code></span> ] )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="threaded.unlock.html" class="methodname">unlock</a></span> ( <span class="methodparam">void</span> )</div> <div class="methodsynopsis dc-description"> <span class="modifier">public</span> <span class="type">bool</span> <span class="methodname"><a href="threaded.wait.html" class="methodname">wait</a></span> ([ <span class="methodparam"><span class="type">int</span> <code class="parameter">$timeout</code></span> ] )</div> }</div> </div> </div> <h2>Table of Contents</h2><ul class="chunklist chunklist_reference"><li><a href="threaded.chunk.html">Threaded::chunk</a> — Manipulation</li><li><a href="threaded.count.html">Threaded::count</a> — Manipulation</li><li><a href="threaded.extend.html">Threaded::extend</a> — Runtime Manipulation</li><li><a href="threaded.from.html">Threaded::from</a> — Creation</li><li><a href="threaded.getterminationinfo.html">Threaded::getTerminationInfo</a> — Error Detection</li><li><a href="thread.isrunning.html">Threaded::isRunning</a> — State Detection</li><li><a href="threaded.isterminated.html">Threaded::isTerminated</a> — State Detection</li><li><a href="threaded.iswaiting.html">Threaded::isWaiting</a> — State Detection</li><li><a href="threaded.lock.html">Threaded::lock</a> — Synchronization</li><li><a href="threaded.merge.html">Threaded::merge</a> — Manipulation</li><li><a href="threaded.notify.html">Threaded::notify</a> — Synchronization</li><li><a href="threaded.notifyone.html">Threaded::notifyOne</a> — Synchronization</li><li><a href="threaded.pop.html">Threaded::pop</a> — Manipulation</li><li><a href="threaded.run.html">Threaded::run</a> — Execution</li><li><a href="threaded.shift.html">Threaded::shift</a> — Manipulation</li><li><a href="threaded.synchronized.html">Threaded::synchronized</a> — Synchronization</li><li><a href="threaded.unlock.html">Threaded::unlock</a> — Synchronization</li><li><a href="threaded.wait.html">Threaded::wait</a> — Synchronization</li></ul> </div> <hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="pthreads.constants.html">Predefined Constants</a></div> <div class="next" style="text-align: right; float: right;"><a href="threaded.chunk.html">Threaded::chunk</a></div> <div class="up"><a href="book.pthreads.html">pthreads</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>