php-doc-en/reference/ev/evloop.xml
Andrey Gromov d790375863 Typo, copypaste errors and so.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@341804 c90b9560-bf6c-de11-be94-00142212c4b1
2017-01-29 09:14:49 +00:00

259 lines
7.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<phpdoc:classref xml:id="class.evloop" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The EvLoop class</title>
<titleabbrev>EvLoop</titleabbrev>
<partintro>
<!-- {{{ EvLoop intro -->
<section xml:id="evloop.intro">
&reftitle.intro;
<para>
Represents an event loop that is always distinct from the
<emphasis>default
loop</emphasis>
. Unlike the
<emphasis>default loop</emphasis>
, it cannot handle
<classname>EvChild</classname>
watchers.
</para>
<para>
Having threads we have to create a loop per thread, and use the
<emphasis>default loop</emphasis>
in the parent thread.
</para>
<para>
The
<emphasis>default event loop</emphasis>
is initialized automatically by
<emphasis>Ev</emphasis>
. It is accessible via methods of the
<classname>Ev</classname>
class, or via
<methodname>EvLoop::defaultLoop</methodname>
method.
</para>
</section>
<!-- }}} -->
<section xml:id="evloop.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass>
<classname>EvLoop</classname>
</ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<modifier>final</modifier>
<classname>EvLoop</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">&Properties;</classsynopsisinfo>
<fieldsynopsis>
<modifier>public</modifier>
<varname linkend="evloop.props.data">data</varname>
</fieldsynopsis>
<fieldsynopsis>
<modifier>public</modifier>
<varname linkend="evloop.props.backend">backend</varname>
</fieldsynopsis>
<fieldsynopsis>
<modifier>public</modifier>
<varname linkend="evloop.props.is-default-loop">is_default_loop</varname>
</fieldsynopsis>
<fieldsynopsis>
<modifier>public</modifier>
<varname linkend="evloop.props.iteration">iteration</varname>
</fieldsynopsis>
<fieldsynopsis>
<modifier>public</modifier>
<varname linkend="evloop.props.pending">pending</varname>
</fieldsynopsis>
<fieldsynopsis>
<modifier>public</modifier>
<varname linkend="evloop.props.io-interval">io_interval</varname>
</fieldsynopsis>
<fieldsynopsis>
<modifier>public</modifier>
<varname linkend="evloop.props.timeout-interval">timeout_interval</varname>
</fieldsynopsis>
<fieldsynopsis>
<modifier>public</modifier>
<varname linkend="evloop.props.depth">depth</varname>
</fieldsynopsis>
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.evloop')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
</classsynopsis>
<!-- }}} -->
</section>
<!-- {{{ EvLoop properties -->
<section xml:id="evloop.props">
&reftitle.properties;
<variablelist>
<varlistentry xml:id="evloop.props.data">
<term>
<varname>data</varname>
</term>
<listitem>
<para>
Custom data attached to loop
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="evloop.props.backend">
<term>
<varname>backend</varname>
</term>
<listitem>
<para>
<emphasis>Readonly</emphasis>
. The
<link linkend="ev.constants.watcher-backends">backend flags</link>
indicating the event backend in use.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="evloop.props.is-default-loop">
<term>
<varname>is_default_loop</varname>
</term>
<listitem>
<para>
<emphasis>Readonly</emphasis>
. &true; if it is the default event loop.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="evloop.props.iteration">
<term>
<varname>iteration</varname>
</term>
<listitem>
<para>
The current iteration count of the loop. See
<methodname>Ev::iteration</methodname>
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="evloop.props.pending">
<term>
<varname>pending</varname>
</term>
<listitem>
<para>
The number of pending watchers.
<constant>0</constant>
indicates that there are no watchers pending.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="evloop.props.io-interval">
<term>
<varname>io_interval</varname>
</term>
<listitem>
<para>
Higher
<varname>io_interval</varname>
allows
<emphasis>libev</emphasis>
to spend more time collecting
<classname>EvIo</classname>
events, so more events can be handled per iteration, at the cost of
increasing latency. Timeouts (both
<classname>EvPeriodic</classname>
and
<classname>EvTimer</classname>
) will not be affected. Setting this to a non-zero value will introduce
an additional
<literal>sleep()</literal>
call into most loop iterations. The sleep time ensures that
<emphasis>libev</emphasis>
will not poll for
<classname>EvIo</classname>
events more often than once per this interval, on average. Many
programs can usually benefit by setting the
<varname>io_interval</varname>
to a value near
<constant>0.1</constant>
, which is often enough for interactive servers(not for games). It
usually doesn't make much sense to set it to a lower value than
<constant>0.01</constant>
, as this approaches the timing granularity of most systems.
</para>
<para>
See also
<link
xlink:href="http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#FUNCTIONS_CONTROLLING_EVENT_LOOPS">FUNCTIONS
CONTROLLING EVENT LOOPS</link>
.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="evloop.props.timeout-interval">
<term>
<varname>timeout_interval</varname>
</term>
<listitem>
<para>
Higher
<varname>timeout_interval</varname>
allows
<emphasis>libev</emphasis>
to spend more time collecting timeouts, at the expense of increased
latency/jitter/inexactness(the watcher callback will be called later).
<classname>EvIo</classname>
watchers will not be affected. Setting this to a non-null value will
not introduce any overhead in
<emphasis>libev</emphasis>
. See also
<link
xlink:href="http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#FUNCTIONS_CONTROLLING_EVENT_LOOPS">FUNCTIONS
CONTROLLING EVENT LOOPS</link>
.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="evloop.props.depth">
<term>
<varname>depth</varname>
</term>
<listitem>
<para>
The recursion depth. See
<methodname>Ev::depth</methodname>
.
</para>
</listitem>
</varlistentry>
</variablelist>
</section>
<!-- }}} -->
</partintro>
&reference.ev.entities.evloop;
</phpdoc:classref>
<!-- 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
-->