mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 08:28:54 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@347824 c90b9560-bf6c-de11-be94-00142212c4b1
130 lines
4.8 KiB
XML
130 lines
4.8 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
|
|
<phpdoc:classref xml:id="class.parallel-channel" 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 parallel\Channel class</title>
|
|
<titleabbrev>parallel\Channel</titleabbrev>
|
|
|
|
<partintro>
|
|
<section>
|
|
<title>Unbuffered Channels</title>
|
|
<para>
|
|
An unbuffered channel will block on calls to <methodname>parallel\Channel::send</methodname> until there is a receiver, and block on calls to
|
|
<methodname>parallel\Channel::recv</methodname> until there is a sender. This means an unbuffered channel is not only a way to share data among tasks
|
|
but also a simple method of synchronization.
|
|
</para>
|
|
<para>
|
|
An unbuffered channel is the fastest way to share data among tasks, requiring the least copying.
|
|
</para>
|
|
</section>
|
|
|
|
<section>
|
|
<title>Buffered Channels</title>
|
|
<para>
|
|
A buffered channel will not block on calls to <methodname>parallel\Channel::send</methodname> until capacity is reached, calls to
|
|
<methodname>parallel\Channel::recv</methodname> will block until there is data in the buffer.
|
|
</para>
|
|
</section>
|
|
|
|
<section>
|
|
<title>Closures over Channels</title>
|
|
<para>
|
|
A powerful feature of parallel channels is that they allow the exchange of closures between tasks (and runtimes).
|
|
</para>
|
|
<para>
|
|
When a closure is sent over a channel the closure is buffered, it doesn't change the buffering of the channel transmitting the closure,
|
|
but it does effect the static scope inside the closure: The same closure sent to different runtimes, or the same runtime,
|
|
will not share their static scope.
|
|
</para>
|
|
<para>
|
|
This means that whenever a closure is executed that was transmitted by a channel, static state will be as it was when the closure was buffered.
|
|
</para>
|
|
</section>
|
|
|
|
<section>
|
|
<title>Anonymous Channels</title>
|
|
<para>
|
|
The anonymous channel constructor allows the programmer to avoid assigning names to every channel: parallel will generate a unique name for anonymous
|
|
channels.
|
|
</para>
|
|
</section>
|
|
|
|
<section xml:id="parallel-channel.synopsis">
|
|
&reftitle.classsynopsis;
|
|
|
|
<!-- {{{ Synopsis -->
|
|
<classsynopsis>
|
|
<ooclass><classname>parallel\Channel</classname></ooclass>
|
|
|
|
<!-- {{{ Class synopsis -->
|
|
<classsynopsisinfo>
|
|
<ooclass>
|
|
<modifier>final</modifier>
|
|
<classname>parallel\Channel</classname>
|
|
</ooclass>
|
|
</classsynopsisinfo>
|
|
<!-- }}} -->
|
|
|
|
<classsynopsisinfo role="comment">Anonymous Constructor</classsynopsisinfo>
|
|
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.parallel-channel')/db:refentry/db:refsect1[@audience='anonymous']/descendant::db:methodsynopsis[not(@role='procedural')])">
|
|
<xi:fallback />
|
|
</xi:include>
|
|
|
|
<classsynopsisinfo role="comment">Access</classsynopsisinfo>
|
|
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.parallel-channel')/db:refentry/db:refsect1[@audience='access']/descendant::db:methodsynopsis[not(@role='procedural')])">
|
|
<xi:fallback />
|
|
</xi:include>
|
|
|
|
<classsynopsisinfo role="comment">Sharing</classsynopsisinfo>
|
|
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.parallel-channel')/db:refentry/db:refsect1[@audience='sharing']/descendant::db:methodsynopsis[not(@role='procedural')])">
|
|
<xi:fallback />
|
|
</xi:include>
|
|
|
|
<classsynopsisinfo role="comment">Closing</classsynopsisinfo>
|
|
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.parallel-channel')/db:refentry/db:refsect1[@audience='close']/descendant::db:methodsynopsis[not(@role='procedural')])">
|
|
<xi:fallback />
|
|
</xi:include>
|
|
|
|
<classsynopsisinfo role="comment">Constant for Infinitely Buffered</classsynopsisinfo>
|
|
<fieldsynopsis>
|
|
<modifier>const</modifier>
|
|
<varname>Infinite</varname>
|
|
</fieldsynopsis>
|
|
|
|
</classsynopsis>
|
|
<!-- }}} -->
|
|
|
|
</section>
|
|
|
|
</partintro>
|
|
|
|
&reference.parallel.parallel.channel.construct;
|
|
&reference.parallel.parallel.channel.make;
|
|
&reference.parallel.parallel.channel.open;
|
|
&reference.parallel.parallel.channel.recv;
|
|
&reference.parallel.parallel.channel.send;
|
|
&reference.parallel.parallel.channel.close;
|
|
|
|
</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
|
|
-->
|