php-doc-en/reference/eio/functions/eio-poll.xml
2011-10-23 18:38:00 +00:00

104 lines
2.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.eio-poll" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>eio_poll</refname>
<refpurpose>Can be to be called whenever there are pending requests that need finishing.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>int</type><methodname>eio_poll</methodname>
<void />
</methodsynopsis>
<para>
<function>eio_poll</function> can be used to implement special event loop.
For this <function>eio_nreqs</function> could be used to test if there are
unprocessed requests.
</para>
<note><para>Applicable only when implementing userspace event loop.</para></note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
If any request invocation returns a non-zero value, returns that value.
Otherwise, it returns <constant>0</constant>.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>eio_poll</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
function res_cb($data, $result) {
var_dump($data);
var_dump($result);
}
eio_nop(EIO_PRI_DEFAULT, "res_cb", "1");
eio_nop(EIO_PRI_DEFAULT, "res_cb", "2");
eio_nop(EIO_PRI_DEFAULT, "res_cb", "3");
while (eio_nreqs()) {
// Some specific IPC or so
eio_poll();
}
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
string(1) "1"
int(0)
string(1) "3"
int(0)
string(1) "2"
int(0)
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member>eio_nreqs</member>
</simplelist>
</refsect1>
</refentry>
<!-- 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
-->