<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.zookeeper.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'function.zookeeper-dispatch.php',
    1 => 'zookeeper_dispatch',
    2 => 'Calls callbacks for pending operations',
  ),
  'up' => 
  array (
    0 => 'ref.zookeeper.php',
    1 => 'ZooKeeper Функції',
  ),
  'prev' => 
  array (
    0 => 'ref.zookeeper.php',
    1 => 'ZooKeeper Функції',
  ),
  'next' => 
  array (
    0 => 'class.zookeeper.php',
    1 => 'Zookeeper',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/zookeeper/functions/zookeeper_dispatch.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.zookeeper-dispatch" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">zookeeper_dispatch</h1>
  <p class="verinfo">(PECL zookeeper &gt;= 0.4.0)</p><p class="refpurpose"><span class="refname">zookeeper_dispatch</span> &mdash; <span class="dc-title">Calls callbacks for pending operations</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.zookeeper-dispatch-description">
  <h3 class="title">Опис</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>zookeeper_dispatch</strong></span>(): <span class="type"><a href="language.types.void.php" class="type void">void</a></span></div>


  <p class="para rdfs-comment">
   The <span class="function"><strong>zookeeper_dispatch()</strong></span> function calls the callbacks passed by operations like <span class="methodname"><a href="zookeeper.get.php" class="methodname">Zookeeper::get()</a></span> or <span class="methodname"><a href="zookeeper.exists.php" class="methodname">Zookeeper::exists()</a></span>.
  </p>

  <div class="caution"><strong class="caution">Застереження</strong>
   <p class="para">
    Since version 0.4.0, this function must be called manually to achieve asynchronous operations. If you want that to be done automatically, you also can declare ticks at the beginning of your program.
   </p>
  </div>

  <p class="para">
   After PHP 7.1, you can ignore this function. This extension uses EG(vm_interrupt) to implement async dispatch.
  </p>

 </div>


 <div class="refsect1 parameters" id="refsect1-function.zookeeper-dispatch-parameters">
  <h3 class="title">Параметри</h3>
  <p class="para">У цієї функції немає
параметрів.</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.zookeeper-dispatch-returnvalues">
  <h3 class="title">Значення, що повертаються</h3>
  <p class="para">
   Не повертає значень.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.zookeeper-dispatch-errors">
  <h3 class="title">Помилки/виключення</h3>
  <p class="para">
   This method emits PHP warning when callback could not be invoked.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.zookeeper-dispatch-examples">
  <h3 class="title">Приклади</h3>
  <div class="example" id="function.zookeeper-dispatch.example.1">
   <p><strong>Приклад #1 <span class="methodname"><strong>zookeeper_dispatch()</strong></span> example #1</strong></p>
   <div class="example-contents"><p>
     Dispatch callbacks manually.
   </p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$client </span><span style="color: #007700">= new </span><span style="color: #0000BB">Zookeeper</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'localhost:2181'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">get</span><span style="color: #007700">(</span><span style="color: #DD0000">'/zookeeper'</span><span style="color: #007700">, function() {<br />    echo </span><span style="color: #DD0000">"Callback was called"</span><span style="color: #007700">.</span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br />});<br />while(</span><span style="color: #0000BB">true</span><span style="color: #007700">) {<br />    </span><span style="color: #0000BB">sleep</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br />    </span><span style="color: #0000BB">zookeeper_dispatch</span><span style="color: #007700">();<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>

  <div class="example" id="function.zookeeper-dispatch.example.2">
   <p><strong>Приклад #2 <span class="methodname"><strong>zookeeper_dispatch()</strong></span> example #2</strong></p>
   <div class="example-contents"><p>
     Declare ticks.
   </p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">declare(</span><span style="color: #0000BB">ticks</span><span style="color: #007700">=</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$client </span><span style="color: #007700">= new </span><span style="color: #0000BB">Zookeeper</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'localhost:2181'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$client</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">get</span><span style="color: #007700">(</span><span style="color: #DD0000">'/zookeeper'</span><span style="color: #007700">, function() {<br />    echo </span><span style="color: #DD0000">"Callback was called"</span><span style="color: #007700">.</span><span style="color: #0000BB">PHP_EOL</span><span style="color: #007700">;<br />});<br />while(</span><span style="color: #0000BB">true</span><span style="color: #007700">) {<br />    </span><span style="color: #0000BB">sleep</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.zookeeper-dispatch-seealso">
  <h3 class="title">Прогляньте також</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="zookeeper.addauth.php" class="methodname" rel="rdfs-seeAlso">Zookeeper::addAuth()</a> - Specify application credentials</span></li>
    <li><span class="methodname"><a href="zookeeper.connect.php" class="methodname" rel="rdfs-seeAlso">Zookeeper::connect()</a> - Create a handle to used communicate with zookeeper</span></li>
    <li><span class="methodname"><a href="zookeeper.construct.php" class="methodname" rel="rdfs-seeAlso">Zookeeper::__construct()</a> - Create a handle to used communicate with zookeeper</span></li>
    <li><span class="methodname"><a href="zookeeper.exists.php" class="methodname" rel="rdfs-seeAlso">Zookeeper::exists()</a> - Checks the existence of a node in zookeeper synchronously</span></li>
    <li><span class="methodname"><a href="zookeeper.get.php" class="methodname" rel="rdfs-seeAlso">Zookeeper::get()</a> - Gets the data associated with a node synchronously</span></li>
    <li><span class="methodname"><a href="zookeeper.getchildren.php" class="methodname" rel="rdfs-seeAlso">Zookeeper::getChildren()</a> - Lists the children of a node synchronously</span></li>
    <li><span class="methodname"><a href="zookeeper.setwatcher.php" class="methodname" rel="rdfs-seeAlso">Zookeeper::setWatcher()</a> - Set a watcher function</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>