mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
update docs for latest changes
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@334904 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
e4742710ff
commit
9bc534d4c3
4 changed files with 203 additions and 1 deletions
|
@ -65,7 +65,7 @@
|
|||
</para>
|
||||
<para>
|
||||
Static Members:
|
||||
When a new context is created ( Thread or Worker ), only the simple members of static classes are copied, no resources or objects are copied into the threading context from static class members. This allows them to function as a kind of thread local storage. For example, upon starting the context, a class whose static members include connection information for a database server, and the connection itself, will only have the simple connection information copied, not the connection. Allowing the new context to initiate a connection in the same way as the context that created it, storing the connection in the same place without affecting the original context.
|
||||
When a new context is created ( Thread or Worker ), only the simple members of static classes are copied, no resources, objects or arrays are copied into the threading context from static class members. This allows them to function as a kind of thread local storage. For example, upon starting the context, a class whose static members include connection information for a database server, and the connection itself, will only have the simple connection information copied, not the connection. Allowing the new context to initiate a connection in the same way as the context that created it, storing the connection in the same place without affecting the original context.
|
||||
</para>
|
||||
<caution>
|
||||
<para>
|
||||
|
|
91
reference/pthreads/threaded/extend.xml
Normal file
91
reference/pthreads/threaded/extend.xml
Normal file
|
@ -0,0 +1,91 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision$ -->
|
||||
|
||||
<refentry xml:id="threaded.extend" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>Threaded::extend</refname>
|
||||
<refpurpose>Runtime Manipulation</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>public</modifier> <type>bool</type><methodname>Threaded::extend</methodname>
|
||||
<methodparam><type>string</type><parameter>class</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Makes thread safe standard class at runtime
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>class</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The class to extend
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
A boolean indication of success
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<para>
|
||||
<example>
|
||||
<title>Runtime inheritance</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
class My {}
|
||||
|
||||
Threaded::extend(My::class);
|
||||
|
||||
$my = new My();
|
||||
|
||||
var_dump($my instanceof Threaded);
|
||||
?>
|
||||
]]>
|
||||
</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
|
||||
-->
|
109
reference/pthreads/threaded/from.xml
Normal file
109
reference/pthreads/threaded/from.xml
Normal file
|
@ -0,0 +1,109 @@
|
|||
<?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>
|
||||
|
||||
<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
|
||||
-->
|
|
@ -23,6 +23,8 @@
|
|||
<function name='threaded::chunk' from='PECL pthreads >= 2.0.0'/>
|
||||
<function name='threaded::pop' from='PECL pthreads >= 2.0.0'/>
|
||||
<function name='threaded::count' from='PECL pthreads >= 2.0.0'/>
|
||||
<function name='threaded::extend' from='PECL pthreads >= 2.0.8'/>
|
||||
<function name='threaded::from' from='PECL pthreads >= 2.0.9'/>
|
||||
|
||||
<function name='thread' from='PECL pthreads >= 2.0.0'/>
|
||||
<function name='thread::start' from='PECL pthreads >= 2.0.0'/>
|
||||
|
|
Loading…
Reference in a new issue