<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.eio.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'function.eio-poll.php',
    1 => 'eio_poll',
    2 => 'Can be to be called whenever there are pending requests that need finishing',
  ),
  'up' => 
  array (
    0 => 'ref.eio.php',
    1 => 'Eio Functions',
  ),
  'prev' => 
  array (
    0 => 'function.eio-open.php',
    1 => 'eio_open',
  ),
  'next' => 
  array (
    0 => 'function.eio-read.php',
    1 => 'eio_read',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/eio/functions/eio-poll.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.eio-poll" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">eio_poll</h1>
  <p class="verinfo">(PECL eio &gt;= 0.0.1dev)</p><p class="refpurpose"><span class="refname">eio_poll</span> &mdash; <span class="dc-title">Can be to be called whenever there are pending requests that need finishing</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.eio-poll-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>eio_poll</strong></span>(): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>

  <p class="simpara">
  <span class="function"><strong>eio_poll()</strong></span> can be used to implement special event loop.
  For this <span class="function"><a href="function.eio-nreqs.php" class="function">eio_nreqs()</a></span> could be used to test if there are
  unprocessed requests.
  </p>

  <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">Applicable only when implementing userspace event loop.</span></p></blockquote>

 </div>


 <div class="refsect1 parameters" id="refsect1-function.eio-poll-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">This function has no parameters.</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.eio-poll-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="simpara">
  If any request invocation returns a non-zero value, returns that value.
  Otherwise, it returns <code class="literal">0</code>.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.eio-poll-examples">
  <h3 class="title">Examples</h3>
  <div class="example" id="example-1">
   <p><strong>Example #1 <span class="function"><strong>eio_poll()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">res_cb</span><span style="color: #007700">(</span><span style="color: #0000BB">$data</span><span style="color: #007700">, </span><span style="color: #0000BB">$result</span><span style="color: #007700">) {<br />    </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$data</span><span style="color: #007700">);<br />    </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$result</span><span style="color: #007700">);<br />}<br /><br /></span><span style="color: #0000BB">eio_nop</span><span style="color: #007700">(</span><span style="color: #0000BB">EIO_PRI_DEFAULT</span><span style="color: #007700">, </span><span style="color: #DD0000">"res_cb"</span><span style="color: #007700">, </span><span style="color: #DD0000">"1"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">eio_nop</span><span style="color: #007700">(</span><span style="color: #0000BB">EIO_PRI_DEFAULT</span><span style="color: #007700">, </span><span style="color: #DD0000">"res_cb"</span><span style="color: #007700">, </span><span style="color: #DD0000">"2"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">eio_nop</span><span style="color: #007700">(</span><span style="color: #0000BB">EIO_PRI_DEFAULT</span><span style="color: #007700">, </span><span style="color: #DD0000">"res_cb"</span><span style="color: #007700">, </span><span style="color: #DD0000">"3"</span><span style="color: #007700">);<br /><br />while (</span><span style="color: #0000BB">eio_nreqs</span><span style="color: #007700">()) {<br />    </span><span style="color: #FF8000">// Some specific IPC or so<br />    </span><span style="color: #0000BB">eio_poll</span><span style="color: #007700">();<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>The above example will output
something similar to:</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">string(1) &quot;1&quot;
int(0)
string(1) &quot;3&quot;
int(0)
string(1) &quot;2&quot;
int(0)</pre>
</div>
   </div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.eio-poll-seealso">
  <h3 class="title">See Also</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.eio-nreqs.php" class="function" rel="rdfs-seeAlso">eio_nreqs()</a> - Returns number of requests to be processed</span></li>
  </ul>
 </div>


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