1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
|
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<reference xml:id="class.parallel-channel" role="class" 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;
</reference>
<!-- 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
-->
|