<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/book.parallel.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'class.parallel-channel.php',
    1 => 'parallel\\Channel',
    2 => 'The parallel\\Channel class',
  ),
  'up' => 
  array (
    0 => 'book.parallel.php',
    1 => 'parallel',
  ),
  'prev' => 
  array (
    0 => 'parallel-future.value.php',
    1 => 'parallel\\Future::value',
  ),
  'next' => 
  array (
    0 => 'parallel-channel.construct.php',
    1 => 'parallel\\Channel::__construct',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/parallel/parallel.channel.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/class.parallel-channel.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="class.parallel-channel" class="reference">

 <h1 class="title">The parallel\Channel class</h1>
 

 <div class="partintro"><p class="verinfo">(0.9.0)</p>
  <div class="section">
    <h2 class="title">Unbuffered Channels</h2>
    <p class="simpara">
     An unbuffered channel will block on calls to <span class="methodname"><a href="parallel-channel.send.php" class="methodname">parallel\Channel::send()</a></span> until there is a receiver, and block on calls to
     <span class="methodname"><a href="parallel-channel.recv.php" class="methodname">parallel\Channel::recv()</a></span> 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.
    </p>
    <p class="simpara">
     An unbuffered channel is the fastest way to share data among tasks, requiring the least copying.
    </p>
  </div>

  <div class="section">
    <h2 class="title">Buffered Channels</h2>
    <p class="simpara">
     A buffered channel will not block on calls to <span class="methodname"><a href="parallel-channel.send.php" class="methodname">parallel\Channel::send()</a></span> until capacity is reached, calls to
     <span class="methodname"><a href="parallel-channel.recv.php" class="methodname">parallel\Channel::recv()</a></span> will block until there is data in the buffer.
    </p>
  </div>

  <div class="section">
    <h2 class="title">Closures over Channels</h2>
    <p class="simpara">
     A powerful feature of parallel channels is that they allow the exchange of closures between tasks (and runtimes).
    </p>
    <p class="simpara">
     When a closure is sent over a channel the closure is buffered, it doesn&#039;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.
    </p>
    <p class="simpara">
     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.
    </p>
  </div>

  <div class="section">
   <h2 class="title">Anonymous Channels</h2>
   <p class="simpara">
    The anonymous channel constructor allows the programmer to avoid assigning names to every channel: parallel will generate a unique name for anonymous
    channels.
   </p>
  </div>

  <div class="section" id="parallel-channel.synopsis">
   <h2 class="title">Klassenbeschreibung</h2>


   <div class="classsynopsis">
    <span class="ooclass"><strong class="classname"></strong></span>


    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">final</span>
      <span class="modifier">class</span> <strong class="classname">parallel\Channel</strong>
     </span>
     {</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Anonymous Constructor */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="parallel-channel.construct.php" class="methodname">__construct</a></span>()</div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="parallel-channel.construct.php" class="methodname">__construct</a></span>(<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$capacity</code></span>)</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Access */</div>
    <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="parallel-channel.make.php" class="methodname">make</a></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$name</code></span>): <span class="type">Channel</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="parallel-channel.make.php" class="methodname">make</a></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$name</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$capacity</code></span>): <span class="type">Channel</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="parallel-channel.open.php" class="methodname">open</a></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$name</code></span>): <span class="type">Channel</span></div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Sharing */</div>
    <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="parallel-channel.recv.php" class="methodname">recv</a></span>(): <span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="parallel-channel.send.php" class="methodname">send</a></span>(<span class="methodparam"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span> <code class="parameter">$value</code></span>): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Closing */</div>
    <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="parallel-channel.close.php" class="methodname">close</a></span>(): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Constant for Infinitely Buffered */</div>
    <div class="fieldsynopsis">
     <span class="modifier">const</span>
      <var class="fieldsynopsis_varname"><var class="varname">Infinite</var></var>;</div>


   }</div>


  </div>

 </div>

 




 




 




 




 




 





<h2>Inhaltsverzeichnis</h2><ul class="chunklist chunklist_reference"><li><a href="parallel-channel.construct.php">parallel\Channel::__construct</a> — Channel Construction</li><li><a href="parallel-channel.make.php">parallel\Channel::make</a> — Access</li><li><a href="parallel-channel.open.php">parallel\Channel::open</a> — Access</li><li><a href="parallel-channel.recv.php">parallel\Channel::recv</a> — Sharing</li><li><a href="parallel-channel.send.php">parallel\Channel::send</a> — Sharing</li><li><a href="parallel-channel.close.php">parallel\Channel::close</a> — Closing</li></ul>
</div>
<?php manual_footer($setup); ?>