1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-25 16:22:20 +01:00

Drop pthreads v2 (#1035)

This commit is contained in:
Sergey Panteleev
2021-10-21 11:28:17 +03:00
committed by GitHub
parent 53afbdaf79
commit 12424df3c8
27 changed files with 4 additions and 2266 deletions

View File

@@ -137,10 +137,7 @@
&reference.pthreads.thread;
&reference.pthreads.worker;
&reference.pthreads.collectable;
&reference.pthreads.modifiers;
&reference.pthreads.pool;
&reference.pthreads.mutex;
&reference.pthreads.cond;
&reference.pthreads.volatile;
</book>

View File

@@ -10,13 +10,6 @@
<!-- {{{ Collectable intro -->
<section xml:id="collectable.intro">
&reftitle.intro;
<caution>
<para>
<classname>Collectable</classname> was previously a class (in pthreads v2
and below). Now, it is an interface in pthreads v3 that is implemented by
the <classname>Threaded</classname> class.
</para>
</caution>
<para>
Represents a garbage-collectable object.
@@ -33,9 +26,9 @@
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>Collectable</classname>
</ooclass>
<oointerface>
<interfacename>Collectable</interfacename>
</oointerface>
</classsynopsisinfo>
<!-- }}} -->

View File

@@ -26,7 +26,7 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Always returns &true;
&return.true.always;
</para>
</refsect1>

View File

@@ -1,71 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="collectable.setgarbage" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Collectable::setGarbage</refname>
<refpurpose>Mark an object as garbage</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
<para>
This method has been removed in pthreads v3.
</para>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>Collectable::setGarbage</methodname>
<void/>
</methodsynopsis>
<para>
Should be called once per object when the object is finished being executed or referenced.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.void;
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>Collectable::isGarbage</methodname></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,73 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<phpdoc:classref xml:id="class.cond" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The Cond class</title>
<titleabbrev>Cond</titleabbrev>
<partintro>
<!-- {{{ Cond intro -->
<section xml:id="cond.intro">
&reftitle.intro;
<warning>
<para>
The <classname>Cond</classname> class has been removed in pthreads v3.
</para>
</warning>
<para>
The static methods contained in the Cond class provide direct access to Posix Condition Variables.
</para>
</section>
<!-- }}} -->
<section xml:id="cond.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>Cond</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>Cond</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.cond')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[not(@role='procedural')])" />
</classsynopsis>
<!-- }}} -->
</section>
</partintro>
&reference.pthreads.entities.cond;
</phpdoc:classref>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,100 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="cond.broadcast" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Cond::broadcast</refname>
<refpurpose>Broadcast a Condition</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
<para>
The <classname>Cond</classname> class has been removed in pthreads v3.
</para>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>final</modifier>
<modifier>public</modifier>
<modifier>static</modifier>
<type>bool</type>
<methodname>Cond::broadcast</methodname>
<methodparam>
<type>int</type>
<parameter>condition</parameter>
</methodparam>
</methodsynopsis>
<para>Broadcast to all Threads blocking on a call to <function>Cond::wait</function>.</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>condition</parameter></term>
<listitem>
<para>A handle to a Condition Variable returned by a previous call to <function>Cond::create</function></para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Condition Broadcasting</title>
<programlisting role="php">
<![CDATA[
<?php
/** You cannot use the "new" keyword, a Cond is not a PHP object **/
$cond = Cond::create();
/** The caller must lock the associated Mutex before a call to broadcast **/
var_dump(Cond::broadcast($cond));
/** Always destroy Cond you have created **/
Cond::destroy($cond);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
bool(true)
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,88 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="cond.create" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Cond::create</refname>
<refpurpose>Create a Condition</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
<para>
The <classname>Cond</classname> class has been removed in pthreads v3.
</para>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>final</modifier>
<modifier>public</modifier>
<modifier>static</modifier>
<type>int</type>
<methodname>Cond::create</methodname>
<void />
</methodsynopsis>
<para>Creates a new Condition Variable for the caller.</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>A handle to a Condition Variable</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Condition Creation and Destruction</title>
<programlisting role="php">
<![CDATA[
<?php
/** You cannot use the "new" keyword, a Cond is not a PHP object **/
$cond = Cond::create();
/** You can now use the Cond in any context **/
var_dump($cond);
/** Always destroy Cond you have created **/
Cond::destroy($cond);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
int(4540682)
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,105 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="cond.destroy" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Cond::destroy</refname>
<refpurpose>Destroy a Condition</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
<para>
The <classname>Cond</classname> class has been removed in pthreads v3.
</para>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>final</modifier>
<modifier>public</modifier>
<modifier>static</modifier>
<type>bool</type>
<methodname>Cond::destroy</methodname>
<methodparam>
<type>int</type>
<parameter>condition</parameter>
</methodparam>
</methodsynopsis>
<para>
Destroying Condition Variable handles must be carried out explicitly by the programmer when they are finished with the Condition Variable.
No Threads should be blocking on a call to <function>Cond::wait</function> when the call to <function>Cond::destroy</function> takes place.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>condition</parameter></term>
<listitem>
<para>
A handle to a Condition Variable returned by a previous call to <function>Cond::create</function>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Condition Creation and Destruction</title>
<programlisting role="php">
<![CDATA[
<?php
/** You cannot use the "new" keyword, a Cond is not a PHP object **/
$cond = Cond::create();
/** You can now use the Cond in any context **/
var_dump($cond);
/** Always destroy Cond you have created **/
Cond::destroy($cond);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
int(4540682)
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,103 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="cond.signal" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Cond::signal</refname>
<refpurpose>Signal a Condition</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
<para>
The <classname>Cond</classname> class has been removed in pthreads v3.
</para>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>final</modifier>
<modifier>public</modifier>
<modifier>static</modifier>
<type>bool</type>
<methodname>Cond::signal</methodname>
<methodparam>
<type>int</type>
<parameter>condition</parameter>
</methodparam>
</methodsynopsis>
<para>
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>condition</parameter></term>
<listitem>
<para>A handle returned by a previous call to <function>Cond::create</function></para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Condition Signalling</title>
<programlisting role="php">
<![CDATA[
<?php
/** You cannot use the "new" keyword, a Cond is not a PHP object **/
$cond = Cond::create();
/** The caller must lock the associated Mutex before a call to broadcast **/
var_dump(Cond::signal($cond));
/** Always destroy Cond you have created **/
Cond::destroy($cond);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
bool(true)
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,125 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="cond.wait" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Cond::wait</refname>
<refpurpose>Wait for Condition</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
<para>
The <classname>Cond</classname> class has been removed in pthreads v3.
</para>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>final</modifier>
<modifier>public</modifier>
<modifier>static</modifier>
<type>bool</type>
<methodname>Cond::wait</methodname>
<methodparam>
<type>int</type>
<parameter>condition</parameter>
</methodparam>
<methodparam>
<type>int</type>
<parameter>mutex</parameter>
</methodparam>
<methodparam choice="opt">
<type>int</type>
<parameter>timeout</parameter>
</methodparam>
</methodsynopsis>
<para>Wait for a signal on a Condition Variable, optionally specifying a timeout to limit waiting time.</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>condition</parameter></term>
<listitem>
<para>A handle returned by a previous call to <function>Cond::create</function>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>mutex</parameter></term>
<listitem>
<para>A handle returned by a previous call to <function>Mutex::create</function> and owned (locked) by the caller.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>timeout</parameter></term>
<listitem>
<para>An optional timeout, in microseconds ( millionths of a second ).</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Waiting for Conditions</title>
<programlisting role="php">
<![CDATA[
<?php
/** PLEASE NOTE THIS EXAMPLE WILL CAUSE THE PROCESS TO HANG **/
$mutex = Mutex::create(true);
/** You cannot use the "new" keyword, a Cond is not a PHP object **/
$cond = Cond::create();
/** The caller must lock the associated Mutex before a call to broadcast **/
var_dump(Cond::wait($cond, $mutex));
/** Always destroy Cond you have created **/
Cond::destroy($cond);
Mutex::unlock($mutex);
Mutex::destroy($mutex);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
int(49685473)
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,90 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<chapter xml:id="pthreads.modifiers" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Method Modifiers</title>
<titleabbrev>Modifiers</titleabbrev>
<warning>
<para>
These semantics are only applicable to pthreads v2 - they have been removed in pthreads v3.
</para>
</warning>
<para>
pthreads overrides the functionality of the protected and private method modifiers in order to provide functionality more suited to multi-threaded objects.
pthreads applies this functionality to all Threaded objects from creation.
</para>
<example>
<title>protected method example: protected methods can only be executed by one Thread at a time.</title>
<programlisting role="php">
<![CDATA[
<?php
class ExampleThread extends Thread {
public function run() {
/* thread code */
if ($this->synchronized()) {
}
}
protected function exclusive() {
/* synchronized method */
}
}
$thread = new ExampleThread();
if ($thread->start()) {
$thread->exclusive();
}
?>
]]>
</programlisting>
</example>
<example>
<title>private method example: private methods may only be executed by the Threaded object during execution</title>
<programlisting role="php">
<![CDATA[
<?php
class ExampleThread extends Thread {
public function run() {
/* thread code */
if ($this->insideonly()) {
}
}
private function insideonly() {
/* private method */
}
}
$thread = new ExampleThread();
if ($thread->start()) {
$thread->insideonly();
}
?>
]]>
</programlisting>
</example>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,73 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<phpdoc:classref xml:id="class.mutex" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The Mutex class</title>
<titleabbrev>Mutex</titleabbrev>
<partintro>
<!-- {{{ Mutex intro -->
<section xml:id="mutex.intro">
&reftitle.intro;
<warning>
<para>
The <classname>Mutex</classname> class has been removed in pthreads v3.
</para>
</warning>
<para>
The static methods contained in the Mutex class provide direct access to Posix Mutex functionality.
</para>
</section>
<!-- }}} -->
<section xml:id="mutex.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>Mutex</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>Mutex</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.mutex')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[not(@role='procedural')])" />
</classsynopsis>
<!-- }}} -->
</section>
</partintro>
&reference.pthreads.entities.mutex;
</phpdoc:classref>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,98 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mutex.create" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Mutex::create</refname>
<refpurpose>Create a Mutex</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
<para>
The <classname>Mutex</classname> class has been removed in pthreads v3.
</para>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>final</modifier>
<modifier>public</modifier>
<modifier>static</modifier>
<type>int</type>
<methodname>Mutex::create</methodname>
<methodparam choice="opt">
<type>bool</type>
<parameter>lock</parameter>
</methodparam>
</methodsynopsis>
<para>Create, and optionally lock a new Mutex for the caller</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>lock</parameter></term>
<listitem>
<para>Setting lock to true will lock the Mutex for the caller before returning the handle</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>A newly created and optionally locked Mutex handle</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Mutex Creation and Destruction</title>
<programlisting role="php">
<![CDATA[
<?php
/** You cannot use the "new" keyword, a Mutex is not a PHP object **/
$mutex = Mutex::create();
/** You have the physical address of the Mutex **/
var_dump($mutex);
/** Always destroy mutex you have created **/
Mutex::destroy($mutex);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
int(40096976)
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,104 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mutex.destroy" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Mutex::destroy</refname>
<refpurpose>Destroy Mutex</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
<para>
The <classname>Mutex</classname> class has been removed in pthreads v3.
</para>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>final</modifier>
<modifier>public</modifier>
<modifier>static</modifier>
<type>bool</type>
<methodname>Mutex::destroy</methodname>
<methodparam>
<type>int</type>
<parameter>mutex</parameter>
</methodparam>
</methodsynopsis>
<para>Destroying Mutex handles must be carried out explicitly by the programmer when they are finished with the Mutex handle. </para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>mutex</parameter></term>
<listitem>
<para>
A handle returned by a previous call to <function>Mutex::create</function>.
The handle should not be locked by any Thread when <function>Mutex::destroy</function> is called.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Mutex Creation and Destruction</title>
<programlisting role="php">
<![CDATA[
<?php
/** You cannot use the "new" keyword, a Mutex is not a PHP object **/
$mutex = Mutex::create();
/** You have the physical address of the Mutex **/
var_dump($mutex);
/** Always destroy mutex you have created **/
Mutex::destroy($mutex);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
int(40096976)
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,105 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mutex.lock" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Mutex::lock</refname>
<refpurpose>Acquire Mutex</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
<para>
The <classname>Mutex</classname> class has been removed in pthreads v3.
</para>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>final</modifier>
<modifier>public</modifier>
<modifier>static</modifier>
<type>bool</type>
<methodname>Mutex::lock</methodname>
<methodparam>
<type>int</type>
<parameter>mutex</parameter>
</methodparam>
</methodsynopsis>
<para>Attempt to lock the Mutex for the caller.</para>
<para>An attempt to lock a Mutex owned (locked) by another Thread will result in blocking.</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>mutex</parameter></term>
<listitem>
<para>A handle returned by a previous call to <function>Mutex::create</function>.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Mutex Locking and Unlocking</title>
<programlisting role="php">
<![CDATA[
<?php
/** You cannot use the "new" keyword, a Mutex is not a PHP object **/
$mutex = Mutex::create();
/** You can now lock the mutex in any context **/
var_dump(Mutex::lock($mutex));
/** It is invalid to attempt to destroy a locked Mutex **/
var_dump(Mutex::unlock($mutex));
/** Always destroy mutex you have created **/
Mutex::destroy($mutex);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
bool(true)
bool(true)
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,103 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mutex.trylock" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Mutex::trylock</refname>
<refpurpose>Attempt to Acquire Mutex</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
<para>
The <classname>Mutex</classname> class has been removed in pthreads v3.
</para>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>final</modifier>
<modifier>public</modifier>
<modifier>static</modifier>
<type>bool</type>
<methodname>Mutex::trylock</methodname>
<methodparam>
<type>int</type>
<parameter>mutex</parameter>
</methodparam>
</methodsynopsis>
<para>Attempt to lock the Mutex for the caller without blocking if the Mutex is owned (locked) by another Thread.</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>mutex</parameter></term>
<listitem>
<para>A handle returned by a previous call to <function>Mutex::create</function>.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Mutex Locking and Unlocking</title>
<programlisting role="php">
<![CDATA[
<?php
/** You cannot use the "new" keyword, a Mutex is not a PHP object **/
$mutex = Mutex::create();
/** You can now try to lock the mutex in any context **/
var_dump(Mutex::trylock($mutex));
/** It is invalid to attempt to destroy a locked Mutex **/
var_dump(Mutex::unlock($mutex));
/** Always destroy mutex you have created **/
Mutex::destroy($mutex);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
bool(true)
bool(true)
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,118 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mutex.unlock" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Mutex::unlock</refname>
<refpurpose>Release Mutex</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
<para>
The <classname>Mutex</classname> class has been removed in pthreads v3.
</para>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>final</modifier>
<modifier>public</modifier>
<modifier>static</modifier>
<type>bool</type>
<methodname>Mutex::unlock</methodname>
<methodparam>
<type>int</type>
<parameter>mutex</parameter>
</methodparam>
<methodparam choice="opt">
<type>bool</type>
<parameter>destroy</parameter>
</methodparam>
</methodsynopsis>
<para>
Attempts to unlock the Mutex for the caller, optionally destroying the Mutex handle.
The calling thread should own the Mutex at the time of the call.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>mutex</parameter></term>
<listitem>
<para>A handle returned by a previous call to <function>Mutex::create</function>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>destroy</parameter></term>
<listitem>
<para>When true pthreads will destroy the Mutex after a successful unlock.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Mutex Locking and Unlocking</title>
<programlisting role="php">
<![CDATA[
<?php
/** You cannot use the "new" keyword, a Mutex is not a PHP object **/
$mutex = Mutex::create();
/** You can now lock the mutex in any context **/
var_dump(Mutex::lock($mutex));
/** It is invalid to attempt to destroy a locked Mutex **/
var_dump(Mutex::unlock($mutex));
/** Always destroy mutex you have created **/
Mutex::destroy($mutex);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
bool(true)
bool(true)
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,69 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="thread.detach" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Thread::detach</refname>
<refpurpose>Execution</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
<para>
This method has been removed in pthreads v3.
</para>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>Thread::detach</methodname>
<void />
</methodsynopsis>
<para>
Detaches the referenced Thread from the calling context, dangerous!
</para>
<warning>
<para>
This method can cause undefined, unsafe behaviour.
It should not usually be used, it is present for completeness and advanced use cases.
</para>
</warning>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,97 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="thread.globally" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Thread::globally</refname>
<refpurpose>Execution</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
<para>
This method has been removed in pthreads v3.
</para>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <modifier>static</modifier> <type>mixed</type><methodname>Thread::globally</methodname>
<void />
</methodsynopsis>
<para>
Will execute a Callable in the global scope
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The return value of the Callable
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Execute in the global scope</title>
<programlisting role="php">
<![CDATA[
<?php
class My extends Thread {
public function run() {
global $std;
Thread::globally(function(){
$std = new stdClass;
});
var_dump($std);
}
}
$my = new My();
$my->start();
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
object(stdClass)#3 (0) {
}
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,102 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="thread.kill" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Thread::kill</refname>
<refpurpose>Execution</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
<para>
This method has been removed in pthreads v3.
</para>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>Thread::kill</methodname>
<void />
</methodsynopsis>
<para>
Forces the referenced Thread to terminate
</para>
<warning>
<para>
The programmer should not ordinarily kill Threads by force
</para>
</warning>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Kill the referenced Thread</title>
<programlisting role="php">
<![CDATA[
<?php
class T extends Thread {
public function run() {
$stdin = fopen("php://stdin", "r");
while(($line = fgets($stdin))) {
echo $line;
}
}
}
$t = new T();
$t->start();
var_dump($t->kill());
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
bool(true)
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,119 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="threaded.from" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Threaded::from</refname>
<refpurpose>Creation</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
<para>
This method has been removed in pthreads v3. With the introduction of
<link linkend="language.oop5.anonymous">anonymous classes</link> in PHP 7,
these can now be used instead.
</para>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>Threaded</type><methodname>Threaded::from</methodname>
<methodparam><type>Closure</type><parameter>run</parameter></methodparam>
<methodparam choice="opt"><type>Closure</type><parameter>construct</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>args</parameter></methodparam>
</methodsynopsis>
<para>
Creates an anonymous Threaded object from closures
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>run</parameter></term>
<listitem>
<para>
The closure to use for ::run
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>construct</parameter></term>
<listitem>
<para>
The constructor to use for anonymous object
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>args</parameter></term>
<listitem>
<para>
The arguments to pass to constructor
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
A new anonymous Threaded object
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Thread safe objects from closures</title>
<programlisting role="php">
<![CDATA[
<?php
$pool = new Pool(4);
$pool->submit(Collectable::from(function(){
echo "Hello World";
$this->setGarbage();
}));
/* ... */
$pool->shutdown();
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
Hello World
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,109 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="threaded.getterminationinfo" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Threaded::getTerminationInfo</refname>
<refpurpose>Error Detection</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
<para>
This method has been removed in pthreads v3. Instead, the body of
<methodname>Threaded::run</methodname> can be wrapped in a try...catch
block to detect errors (since most errors in PHP 7 have been converted to
exceptions).
</para>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>array</type><methodname>Threaded::getTerminationInfo</methodname>
<void />
</methodsynopsis>
<para>
Retrieves terminal error information from the referenced object
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
array containing the termination conditions of the referenced object
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Detecting fatal errors in Threads</title>
<programlisting role="php">
<![CDATA[
<?php
class My extends Thread {
public function run() {
@not_found();
}
}
$my = new My();
$my->start();
$my->join();
var_dump($my->isTerminated(), $my->getTerminationInfo());
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
bool(true)
array(4) {
["scope"]=>
string(2) "My"
["function"]=>
string(3) "run"
["file"]=>
string(29) "/usr/src/pthreads/sandbox.php"
["line"]=>
int(4)
}
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,100 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="threaded.iswaiting" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Threaded::isWaiting</refname>
<refpurpose>State Detection</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
<para>
This method has been removed in pthreads v3.
</para>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>Threaded::isWaiting</methodname>
<void />
</methodsynopsis>
<para>
Tell if the referenced object is waiting for notification
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
A boolean indication of state
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Detect the state of the referenced object</title>
<programlisting role="php">
<![CDATA[
<?php
class My extends Thread {
public function run() {
$this->synchronized(function($thread){
if (!$this->done)
$thread->wait();
}, $this);
}
protected $done;
}
$my = new My();
$my->start();
$my->synchronized(function($thread){
var_dump(
$thread->isWaiting());
$thread->done = true;
$thread->notify();
}, $my);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
bool(true)
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,95 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="threaded.lock" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Threaded::lock</refname>
<refpurpose>Synchronization</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
<para>
This method has been removed in pthreads v3. The
<methodname>Threaded::synchronized</methodname> method should now be used.
</para>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>Threaded::lock</methodname>
<void />
</methodsynopsis>
<para>
Lock the referenced objects property table
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
A boolean indication of success
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Locking Object Properties</title>
<programlisting role="php">
<![CDATA[
<?php
class My extends Thread {
public function run() {
var_dump($this->lock());
/** nobody can read or write **/
var_dump($this->unlock());
/** reading / writing resumed for all other contexts */
}
}
$my = new My();
$my->start();
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
bool(true)
bool(true)
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,95 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="threaded.unlock" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Threaded::unlock</refname>
<refpurpose>Synchronization</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
<para>
This method has been removed in pthreads v3. The
<methodname>Threaded::synchronized</methodname> method should now be used.
</para>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>Threaded::unlock</methodname>
<void />
</methodsynopsis>
<para>
Unlock the referenced objects storage for the calling context
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Locking the property table of a threaded object</title>
<programlisting role="php">
<![CDATA[
<?php
class My extends Thread {
public function run() {
var_dump($this->lock());
/** nobody can read or write **/
var_dump($this->unlock());
/** reading / writing resumed for all other contexts */
}
}
$my = new My();
$my->start();
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
bool(true)
bool(true)
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -13,32 +13,24 @@
<function name='threaded::notify' from='PECL pthreads &gt;= 2.0.0'/>
<function name='threaded::notifyone' from='PECL pthreads &gt;= 3.0.0'/>
<function name='threaded::isrunning' from='PECL pthreads &gt;= 2.0.0'/>
<function name='threaded::iswaiting' from='PECL pthreads &lt; 3.0.0'/>
<function name='threaded::isterminated' from='PECL pthreads &gt;= 2.0.0'/>
<function name='threaded::getterminationinfo' from='PECL pthreads &lt; 3.0.0'/>
<function name='threaded::synchronized' from='PECL pthreads &gt;= 2.0.0'/>
<function name='threaded::lock' from='PECL pthreads &lt; 3.0.0'/>
<function name='threaded::unlock' from='PECL pthreads &lt; 3.0.0'/>
<function name='threaded::merge' from='PECL pthreads &gt;= 2.0.0'/>
<function name='threaded::shift' from='PECL pthreads &gt;= 2.0.0'/>
<function name='threaded::chunk' from='PECL pthreads &gt;= 2.0.0'/>
<function name='threaded::pop' from='PECL pthreads &gt;= 2.0.0'/>
<function name='threaded::count' from='PECL pthreads &gt;= 2.0.0'/>
<function name='threaded::extend' from='PECL pthreads &gt;= 2.0.8'/>
<function name='threaded::from' from='PECL pthreads &gt;= 2.0.9'/>
<function name='thread' from='PECL pthreads &gt;= 2.0.0'/>
<function name='thread::start' from='PECL pthreads &gt;= 2.0.0'/>
<function name='thread::join' from='PECL pthreads &gt;= 2.0.0'/>
<function name='thread::detach' from='PECL pthreads &lt; 3.0.0'/>
<function name='thread::isstarted' from='PECL pthreads &gt;= 2.0.0'/>
<function name='thread::isjoined' from='PECL pthreads &gt;= 2.0.0'/>
<function name='thread::getthreadid' from='PECL pthreads &gt;= 2.0.0'/>
<function name='thread::getcreatorid' from='PECL pthreads &gt;= 2.0.0'/>
<function name='thread::getcurrentthreadid' from='PECL pthreads &gt;= 2.0.0'/>
<function name='thread::getcurrentthread' from='PECL pthreads &gt;= 2.0.0'/>
<function name='thread::kill' from='PECL pthreads &lt; 3.0.0'/>
<function name='thread::globally' from='PECL pthreads &lt; 3.0.0'/>
<function name='worker' from='PECL pthreads &gt;= 2.0.0'/>
<function name='worker::shutdown' from='PECL pthreads &gt;= 2.0.0'/>
@@ -46,24 +38,8 @@
<function name='worker::unstack' from='PECL pthreads &gt;= 2.0.0'/>
<function name='worker::getstacked' from='PECL pthreads &gt;= 2.0.0'/>
<function name='worker::isshutdown' from='PECL pthreads &gt;= 2.0.0'/>
<function name='worker::isworking' from='PECL pthreads &gt;= 2.0.0'/>
<function name='worker::collect' from='PECL pthreads &gt;= 3.0.0'/>
<function name='mutex' from='PECL pthreads &lt; 3.0.0'/>
<function name='mutex::__construct' from='PECL pthreads &lt; 3.0.0'/>
<function name='mutex::create' from='PECL pthreads &lt; 3.0.0'/>
<function name='mutex::lock' from='PECL pthreads &lt; 3.0.0'/>
<function name='mutex::trylock' from='PECL pthreads &lt; 3.0.0'/>
<function name='mutex::unlock' from='PECL pthreads &lt; 3.0.0'/>
<function name='mutex::destroy' from='PECL pthreads &lt; 3.0.0'/>
<function name='cond' from='PECL pthreads &lt; 3.0.0'/>
<function name='cond::create' from='PECL pthreads &lt; 3.0.0'/>
<function name='cond::signal' from='PECL pthreads &lt; 3.0.0'/>
<function name='cond::wait' from='PECL pthreads &lt; 3.0.0'/>
<function name='cond::broadcast' from='PECL pthreads &lt; 3.0.0'/>
<function name='cond::destroy' from='PECL pthreads &lt; 3.0.0'/>
<function name='pool' from='PECL pthreads &gt;= 2.0.0'/>
<function name='pool::__construct' from='PECL pthreads &gt;= 2.0.0'/>
<function name='pool::resize' from='PECL pthreads &gt;= 2.0.0'/>
@@ -74,7 +50,6 @@
<function name='collectable' from='PECL pthreads &gt;= 2.0.8'/>
<function name='collectable::isgarbage' from='PECL pthreads &gt;= 2.0.8'/>
<function name='collectable::setgarbage' from='PECL pthreads &lt; 3.0.0'/>
<function name='volatile' from='PECL pthreads &gt;= 3.0.0'/>
</versions>

View File

@@ -1,85 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="worker.isworking" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>Worker::isWorking</refname>
<refpurpose>State Detection</refpurpose>
</refnamediv>
<refsynopsisdiv>
<warning>
<para>
This method has been removed in pthreads v3. The
<methodname>Worker::getStacked</methodname> method should be used to see if
the worker still has tasks to execute.
</para>
</warning>
</refsynopsisdiv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>Worker::isWorking</methodname>
<void />
</methodsynopsis>
<para>
Tell if a Worker is executing Stackables
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns whether the worker is still working or not.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Detect the state of a Worker</title>
<programlisting role="php">
<![CDATA[
<?php
$my = new Worker();
$my->start();
/* ... */
if ($my->isWorking()) {
/* ... the Worker is busy executing another object */
}
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->