Add: docs for evwatcher, evtimer

Fix: missing evio, evstat method docs

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@328905 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Ruslan Osmanov 2012-12-27 10:09:23 +00:00
parent da1f814030
commit a502c723a6
16 changed files with 312 additions and 508 deletions

View file

@ -4,19 +4,21 @@
<refentry xml:id="evio.createstopped" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>EvIo::createStopped</refname>
<refpurpose>The createStopped purpose</refpurpose>
<refpurpose>Create stopped EvIo watcher object</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>final</modifier>
<modifier>public</modifier> <modifier>static</modifier> <type>void</type><methodname>EvIo::createStopped</methodname>
<methodparam><type>string</type><parameter>fd</parameter></methodparam>
<methodparam><type>string</type><parameter>events</parameter></methodparam>
<methodparam><type>string</type><parameter>callback</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>data</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>priority</parameter></methodparam>
<modifier>public</modifier> <modifier>static</modifier> <type>EvIo</type><methodname>EvIo::createStopped</methodname>
<methodparam><type>mixed</type><parameter>fd</parameter></methodparam>
<methodparam><type>int</type><parameter>events</parameter></methodparam>
<methodparam><type>callable</type><parameter>callback</parameter></methodparam>
<methodparam
choice="opt"><type>mixed</type><parameter>data</parameter><initializer>&null;</initializer></methodparam>
<methodparam
choice="opt"><type>int</type><parameter>priority</parameter><initializer>0</initializer></methodparam>
</methodsynopsis>
<para>
The same as <methodname>EvIo::__construct</methodname>, but doesn't start

View file

@ -4,7 +4,7 @@
<refentry xml:id="evstat.set" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>EvStat::set</refname>
<refpurpose>The set purpose</refpurpose>
<refpurpose>Configures the watcher</refpurpose>
</refnamediv>
<refsect1 role="description">
@ -12,14 +12,12 @@
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>EvStat::set</methodname>
<methodparam><type>string</type><parameter>path</parameter></methodparam>
<methodparam><type>string</type><parameter>interval</parameter></methodparam>
<methodparam><type>double</type><parameter>interval</parameter></methodparam>
</methodsynopsis>
<para>
Configures the watcher.
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">
@ -29,7 +27,7 @@
<term><parameter>path</parameter></term>
<listitem>
<para>
The path to wait for status changes on.
</para>
</listitem>
</varlistentry>
@ -37,7 +35,9 @@
<term><parameter>interval</parameter></term>
<listitem>
<para>
Hint on how quickly a change is expected to be detected and should
normally be specified as <constant>0.0</constant> to let
<emphasis>libev</emphasis> choose a suitable value.
</para>
</listitem>
</varlistentry>
@ -47,40 +47,10 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.void;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>EvStat::set</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
/* ... */
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
...
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -12,9 +12,38 @@
<section xml:id="evtimer.intro">
&reftitle.intro;
<para>
<classname>EvTimer</classname> watchers are simple relative timers that
generate an event after a given time, and optionally repeating in regular
intervals after that.
</para>
</section>
<para>
The timers are based on real time, that is, if you register an event that
times out after an hour and you reset your system clock to
<emphasis>January last year</emphasis>, it will still time out
after(roughly) one hour. "Roughly" because detecting time jumps is hard,
and some inaccuracies are unavoidable.
</para>
<para>
The callback is guaranteed to be invoked only after its timeout has passed
(not at, so on systems with very low-resolution clocks this might introduce
a small delay). If multiple timers become ready during the same loop
iteration then the ones with earlier time-out values are invoked before
ones of the same priority with later time-out values (but this is no longer
true when a callback calls <methodname>EvLoop::run</methodname>
recursively).
</para>
<para>
The timer itself will do a best-effort at avoiding drift, that is, if you
configure a timer to trigger every <constant>10</constant> seconds, then it
will normally trigger at exactly <constant>10</constant> second intervals.
If, however, your program cannot keep up with the timer because it takes
longer than those <constant>10</constant> seconds to do stuff) the timer
will not fire more than once per event loop iteration.
</para>
</section>
<!-- }}} -->
<section xml:id="evtimer.synopsis">
@ -46,6 +75,8 @@
<varname linkend="evtimer.props.remaining">remaining</varname>
</fieldsynopsis>
<classsynopsisinfo role="comment">&InheritedProperties;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('evwatcher.synopsis')/descendant::db:fieldsynopsis)" />
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.evtimer')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
@ -63,47 +94,41 @@
<section xml:id="evtimer.props">
&reftitle.properties;
<variablelist>
<varlistentry xml:id="evtimer.props.is-active">
<term><varname>is_active</varname></term>
<listitem>
<para></para>
</listitem>
</varlistentry>
<varlistentry xml:id="evtimer.props.data">
<term><varname>data</varname></term>
<listitem>
<para></para>
</listitem>
</varlistentry>
<varlistentry xml:id="evtimer.props.is-pending">
<term><varname>is_pending</varname></term>
<listitem>
<para></para>
</listitem>
</varlistentry>
<varlistentry xml:id="evtimer.props.priority">
<term><varname>priority</varname></term>
<listitem>
<para></para>
</listitem>
</varlistentry>
<varlistentry xml:id="evtimer.props.repeat">
<term><varname>repeat</varname></term>
<listitem>
<para></para>
<para>
If repeat is <constant>0.0</constant>, then it will automatically be stopped once the timeout
is reached. If it is positive, then the timer will automatically be
configured to trigger again every repeat seconds later, until stopped
manually.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="evtimer.props.remaining">
<term><varname>remaining</varname></term>
<listitem>
<para></para>
<para>
Returns the remaining time until a timer fires. If the timer is active,
then this time is relative to the current event loop time,
otherwise it&apos;s the timeout value currently configured.
</para>
<para>
That is, after instanciating an <classname>EvTimer</classname> with an
<parameter>after</parameter> value of <constant>5.0</constant> and
<parameter>repeat</parameter> value of <constant>7.0</constant>,
<varname>remaining</varname> returns <constant>5.0</constant>. When the
timer is started and one second passes, <varname>remaining</varname>
will return <constant>4.0</constant>. When the timer expires and is
restarted, it will return roughly <constant>7.0</constant>(likely
slightly less as callback invocation takes some time too), and so on.
</para>
</listitem>
</varlistentry>
</variablelist>
</section>
<!-- }}} -->
</partintro>
&reference.ev.entities.evtimer;

View file

@ -4,7 +4,7 @@
<refentry xml:id="evtimer.again" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>EvTimer::again</refname>
<refpurpose>The again purpose</refpurpose>
<refpurpose>Restarts the timer watcher</refpurpose>
</refnamediv>
<refsect1 role="description">
@ -14,10 +14,29 @@
<void />
</methodsynopsis>
<para>
This will act as if the timer timed out and restart it again if it is
repeating. The exact semantics are:
</para>
&warn.undocumented.func;
<orderedlist>
<listitem>
<para>
if the timer is pending, its pending status is cleared.
</para>
</listitem>
<listitem>
<para>
if the timer is started but non-repeating, stop it (as if it timed out).
</para>
</listitem>
<listitem>
<para>
if the timer is repeating, either start it if necessary (with the
<varname>repeat</varname> value), or reset the running timer to the
<varname>repeat</varname> value.
</para>
</listitem>
</orderedlist>
</refsect1>
@ -29,37 +48,14 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.void;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>EvTimer::again</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
/* ... */
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
...
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member></member>
<member><methodname>EvWatcher::stop</methodname></member>
</simplelist>
</refsect1>

View file

@ -4,25 +4,25 @@
<refentry xml:id="evtimer.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>EvTimer::__construct</refname>
<refpurpose>The __construct purpose</refpurpose>
<refpurpose>Constructs an EvTimer watcher object</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <methodname>EvTimer::__construct</methodname>
<methodparam><type>string</type><parameter>after</parameter></methodparam>
<methodparam><type>string</type><parameter>repeat</parameter></methodparam>
<methodparam><type>string</type><parameter>callback</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>data</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>priority</parameter></methodparam>
<methodparam><type>double</type><parameter>after</parameter></methodparam>
<methodparam><type>double</type><parameter>repeat</parameter></methodparam>
<methodparam><type>callable</type><parameter>callback</parameter></methodparam>
<methodparam
choice="opt"><type>mixed</type><parameter>data</parameter><initializer>&null;</initializer></methodparam>
<methodparam
choice="opt"><type>int</type><parameter>priority</parameter><initializer>0</initializer></methodparam>
</methodsynopsis>
<para>
Constructs an EvTimer watcher object.
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">
@ -32,7 +32,7 @@
<term><parameter>after</parameter></term>
<listitem>
<para>
Configures the timer to trigger after <parameter>after</parameter> seconds.
</para>
</listitem>
</varlistentry>
@ -40,7 +40,10 @@
<term><parameter>repeat</parameter></term>
<listitem>
<para>
If repeat is <constant>0.0</constant>, then it will automatically be stopped once the timeout
is reached. If it is positive, then the timer will automatically be
configured to trigger again every repeat seconds later, until stopped
manually.
</para>
</listitem>
</varlistentry>
@ -48,7 +51,7 @@
<term><parameter>callback</parameter></term>
<listitem>
<para>
See <link linkend="ev.watcher-callbacks">Watcher callbacks</link>.
</para>
</listitem>
</varlistentry>
@ -56,7 +59,7 @@
<term><parameter>data</parameter></term>
<listitem>
<para>
Custom data associated with the watcher.
</para>
</listitem>
</varlistentry>
@ -64,7 +67,7 @@
<term><parameter>priority</parameter></term>
<listitem>
<para>
<link linkend="ev.constants.watcher-pri">Watcher priority</link>
</para>
</listitem>
</varlistentry>
@ -74,37 +77,98 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns EvTimer object on success.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>EvTimer::__construct</function> example</title>
<programlisting role="php">
<example>
<title>Simple timers</title>
<programlisting role="php">
<![CDATA[
<?php
// Create and start timer firing after 2 seconds
$w1 = new EvTimer(2, 0, function () {
echo "2 seconds elapsed\n";
});
/* ... */
// Create and launch timer firing after 2 seconds repeating each second
// until we manually stop it
$w2 = new EvTimer(2, 1, function ($w) {
echo "is called every second, is launched after 2 seconds\n";
echo "iteration = ", Ev::iteration(), PHP_EOL;
// Stop the watcher after 5 iterations
Ev::iteration() == 5 and $w->stop();
// Stop the watcher if further calls cause more than 10 iterations
Ev::iteration() >= 10 and $w->stop();
});
// Create stopped timer. It will be inactive until we start it ourselves
$w_stopped = EvTimer::createStopped(10, 5, function($w) {
echo "Callback of a timer created as stopped\n";
// Stop the watcher after 2 iterations
Ev::iteration() >= 2 and $w->stop();
});
// Loop until Ev::stop() is called or all of watchers stop
Ev::run();
// Start and look if it works
$w_stopped->start();
echo "Run single iteration\n";
Ev::run(Ev::RUN_ONCE);
echo "Restart the second watcher and try to handle the same events, but don't block\n";
$w2->again();
Ev::run(Ev::RUN_NOWAIT);
$w = new EvTimer(10, 0, function() {});
echo "Running a blocking loop\n";
Ev::run();
echo "END\n";
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
...
2 seconds elapsed
is called every second, is launched after 2 seconds
iteration = 1
is called every second, is launched after 2 seconds
iteration = 2
is called every second, is launched after 2 seconds
iteration = 3
is called every second, is launched after 2 seconds
iteration = 4
is called every second, is launched after 2 seconds
iteration = 5
Run single iteration
Callback of a timer created as stopped
Restart the second watcher and try to handle the same events, but don't block
Running a blocking loop
is called every second, is launched after 2 seconds
iteration = 8
is called every second, is launched after 2 seconds
iteration = 9
is called every second, is launched after 2 seconds
iteration = 10
END
]]>
</screen>
</example>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member></member>
<member><methodname>EvTimer::createStopped</methodname></member>
<member><classname>EvPeriodic</classname></member>
<member><link xlink:href="http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#code_ev_timer_code_relative_and_opti">ev_timer - relative and optionally repeating timeouts</link></member>
<member><link xlink:href="http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#Be_smart_about_timeouts">Be smart about timeouts</link></member>
</simplelist>
</refsect1>

View file

@ -4,26 +4,28 @@
<refentry xml:id="evtimer.createstopped" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>EvTimer::createStopped</refname>
<refpurpose>The createStopped purpose</refpurpose>
<refpurpose>Creates EvTimer stopped watcher object</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>final</modifier>
<modifier>public</modifier> <modifier>static</modifier> <type>void</type><methodname>EvTimer::createStopped</methodname>
<methodparam><type>string</type><parameter>after</parameter></methodparam>
<methodparam><type>string</type><parameter>repeat</parameter></methodparam>
<methodparam><type>string</type><parameter>callback</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>data</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>priority</parameter></methodparam>
<modifier>public</modifier> <modifier>static</modifier> <type>EvTimer</type><methodname>EvTimer::createStopped</methodname>
<methodparam><type>double</type><parameter>after</parameter></methodparam>
<methodparam><type>double</type><parameter>repeat</parameter></methodparam>
<methodparam><type>callable</type><parameter>callback</parameter></methodparam>
<methodparam
choice="opt"><type>mixed</type><parameter>data</parameter><initializer>&null;</initializer></methodparam>
<methodparam
choice="opt"><type>int</type><parameter>priority</parameter><initializer>0</initializer></methodparam>
</methodsynopsis>
<para>
Creates EvTimer stopped watcher object. Unlike
<methodname>EvTimer::__construct</methodname>, this method doesn't start the
watcher automatically.
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">
@ -33,7 +35,7 @@
<term><parameter>after</parameter></term>
<listitem>
<para>
Configures the timer to trigger after <parameter>after</parameter> seconds.
</para>
</listitem>
</varlistentry>
@ -41,7 +43,10 @@
<term><parameter>repeat</parameter></term>
<listitem>
<para>
If repeat is <constant>0.0</constant>, then it will automatically be stopped once the timeout
is reached. If it is positive, then the timer will automatically be
configured to trigger again every repeat seconds later, until stopped
manually.
</para>
</listitem>
</varlistentry>
@ -49,7 +54,7 @@
<term><parameter>callback</parameter></term>
<listitem>
<para>
See <link linkend="ev.watcher-callbacks">Watcher callbacks</link>.
</para>
</listitem>
</varlistentry>
@ -57,7 +62,7 @@
<term><parameter>data</parameter></term>
<listitem>
<para>
Custom data associated with the watcher.
</para>
</listitem>
</varlistentry>
@ -65,47 +70,56 @@
<term><parameter>priority</parameter></term>
<listitem>
<para>
<link linkend="ev.constants.watcher-pri">Watcher priority</link>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns EvTimer watcher object on success.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>EvTimer::createStopped</function> example</title>
<programlisting role="php">
<example>
<title>Monotor changes of /var/log/messages. Avoid missing updates by means of one second delay</title>
<programlisting role="php">
<![CDATA[
<?php
$timer = EvTimer::createStopped(0., 1.02, function ($w) {
$w->stop();
/* ... */
$stat = $w->data;
// 1 second after the most recent change of the file
printf("Current size: %ld\n", $stat->attr()['size']);
});
$stat = new EvStat("/var/log/messages", 0., function () use ($timer) {
// Reset timer watcher
$timer->again();
});
$timer->data = $stat;
Ev::run();
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
...
]]>
</screen>
</example>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member></member>
<member><methodname>EvTimer::__construct</methodname></member>
<member><classname>EvPeriodic</classname></member>
</simplelist>
</refsect1>

View file

@ -4,22 +4,20 @@
<refentry xml:id="evtimer.set" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>EvTimer::set</refname>
<refpurpose>The set purpose</refpurpose>
<refpurpose>Configures the watcher</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>EvTimer::set</methodname>
<methodparam><type>string</type><parameter>after</parameter></methodparam>
<methodparam><type>string</type><parameter>repeat</parameter></methodparam>
<methodparam><type>double</type><parameter>after</parameter></methodparam>
<methodparam><type>double</type><parameter>repeat</parameter></methodparam>
</methodsynopsis>
<para>
Configures the watcher
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">
@ -29,7 +27,7 @@
<term><parameter>after</parameter></term>
<listitem>
<para>
Configures the timer to trigger after <parameter>after</parameter> seconds.
</para>
</listitem>
</varlistentry>
@ -37,7 +35,10 @@
<term><parameter>repeat</parameter></term>
<listitem>
<para>
If repeat is <constant>0.0</constant>, then it will automatically be stopped once the timeout
is reached. If it is positive, then the timer will automatically be
configured to trigger again every repeat seconds later, until stopped
manually.
</para>
</listitem>
</varlistentry>
@ -47,40 +48,10 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.void;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>EvTimer::set</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
/* ... */
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
...
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -4,21 +4,24 @@
<refentry xml:id="evwatcher.clear" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>EvWatcher::clear</refname>
<refpurpose>The clear purpose</refpurpose>
<refpurpose>Clear watcher pending status</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>EvWatcher::clear</methodname>
<modifier>public</modifier> <type>int</type><methodname>EvWatcher::clear</methodname>
<void />
</methodsynopsis>
<para>
<para> If the watcher is pending, this method clears its <varname>pending</varname> status and
returns its <varname>revents</varname> bitset(as if its callback was invoked). If the
watcher isn&apos;t pending it does nothing and returns
<constant>0</constant>.
</para>
<para>
Sometimes it can be useful to "poll" a watcher instead of waiting for its
callback to be invoked, which can be accomplished with this function.
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">
@ -29,40 +32,12 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
In case if the watcher is pending, returns <varname>revents</varname> bitset as if the <link
linkend="ev.watcher-callbacks">watcher callback</link> had been invoked.
Otherwise returns <constant>0</constant>.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>EvWatcher::clear</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
/* ... */
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
...
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -20,48 +20,6 @@
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>EvWatcher::__construct</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
/* ... */
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
...
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -4,21 +4,20 @@
<refentry xml:id="evwatcher.feed" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>EvWatcher::feed</refname>
<refpurpose>The feed purpose</refpurpose>
<refpurpose>Feeds the given revents set into the event loop</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>EvWatcher::feed</methodname>
<methodparam><type>string</type><parameter>revents</parameter></methodparam>
<methodparam><type>int</type><parameter>revents</parameter></methodparam>
</methodsynopsis>
<para>
Feeds the given revents set into the event loop, as if the specified event
had happened for the watcher.
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">
@ -28,7 +27,7 @@
<term><parameter>revents</parameter></term>
<listitem>
<para>
Bit mask of watcher <link linkend="ev.constants.watcher-revents">received events</link>.
</para>
</listitem>
</varlistentry>
@ -38,40 +37,10 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.void;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>EvWatcher::feed</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
/* ... */
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
...
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -4,21 +4,19 @@
<refentry xml:id="evwatcher.getloop" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>EvWatcher::getLoop</refname>
<refpurpose>The getLoop purpose</refpurpose>
<refpurpose>Returns the loop responsible for the watcher</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>EvWatcher::getLoop</methodname>
<modifier>public</modifier> <type>EvLoop</type><methodname>EvWatcher::getLoop</methodname>
<void />
</methodsynopsis>
<para>
Returns the loop responsible for the watcher
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">
@ -29,40 +27,11 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns <classname>EvLoop</classname> event loop object responsible for the
watcher.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>EvWatcher::getLoop</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
/* ... */
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
...
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -4,21 +4,20 @@
<refentry xml:id="evwatcher.invoke" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>EvWatcher::invoke</refname>
<refpurpose>The invoke purpose</refpurpose>
<refpurpose>Invokes the watcher callback with the given received events bit
mask</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>EvWatcher::invoke</methodname>
<methodparam><type>string</type><parameter>revents</parameter></methodparam>
<methodparam><type>int</type><parameter>revents</parameter></methodparam>
</methodsynopsis>
<para>
Invokes the watcher callback with the given received events bit mask.
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">
@ -28,7 +27,7 @@
<term><parameter>revents</parameter></term>
<listitem>
<para>
Bit mask of watcher <link linkend="ev.constants.watcher-revents">received events</link>.
</para>
</listitem>
</varlistentry>
@ -38,40 +37,10 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.void;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>EvWatcher::invoke</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
/* ... */
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
...
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -4,20 +4,31 @@
<refentry xml:id="evwatcher.keepalive" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>EvWatcher::keepalive</refname>
<refpurpose>The keepalive purpose</refpurpose>
<refpurpose>Configures whether to keep the loop from returning</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>EvWatcher::keepalive</methodname>
<methodparam choice="opt"><type>string</type><parameter>value</parameter></methodparam>
<modifier>public</modifier> <type>bool</type><methodname>EvWatcher::keepalive</methodname>
<methodparam choice="opt"><type>bool</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
Configures whether to keep the loop from returning. If you set keepalive
<parameter>value</parameter> to &false;, then even though your watcher is
active, it won't keep <methodname>Ev::run</methodname> or
<methodname>EvLoop::run</methodname> from returning.
</para>
<para>
Watchers have keepalive <parameter>value</parameter> &true; by default.
</para>
<para>
Clearing keepalive status may be useful in cases when you wouldn&apos;t want
to keep
<methodname>Ev::run</methodname>/<methodname>EvLoop::run</methodname> from
returning just because of the(possibly long running watcher - a socket
watcher etc.)
</para>
&warn.undocumented.func;
</refsect1>
@ -28,7 +39,10 @@
<term><parameter>value</parameter></term>
<listitem>
<para>
If you set keepalive
<parameter>value</parameter> to &false;, then even though your watcher is
active, it won't keep <methodname>Ev::run</methodname> or
<methodname>EvLoop::run</methodname> from returning.
</para>
</listitem>
</varlistentry>
@ -38,40 +52,27 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the previous state.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>EvWatcher::keepalive</function> example</title>
<title>Register an I/O watcher for some UDP socket but do not keep the
event loop from running just because of that watcher.</title>
<programlisting role="php">
<![CDATA[
<?php
/* ... */
$udp_socket = ...
$udp_watcher = new EvIo($udp_socket, Ev::READ, function () { /* ... */ });
$udp_watcher->keepalive(FALSE);
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
...
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -4,21 +4,19 @@
<refentry xml:id="evwatcher.setcallback" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>EvWatcher::setCallback</refname>
<refpurpose>The setCallback purpose</refpurpose>
<refpurpose>Sets new callback for the watcher</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>EvWatcher::setCallback</methodname>
<methodparam><type>string</type><parameter>callback</parameter></methodparam>
<methodparam><type>callable</type><parameter>callback</parameter></methodparam>
</methodsynopsis>
<para>
Sets new callback for the watcher
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">
@ -28,7 +26,7 @@
<term><parameter>callback</parameter></term>
<listitem>
<para>
See <link linkend="ev.watcher-callbacks">Watcher callbacks</link>.
</para>
</listitem>
</varlistentry>
@ -38,40 +36,10 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.void;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>EvWatcher::setCallback</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
/* ... */
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
...
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file

View file

@ -4,7 +4,7 @@
<refentry xml:id="evwatcher.start" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>EvWatcher::start</refname>
<refpurpose>The start purpose</refpurpose>
<refpurpose>Starts the watcher</refpurpose>
</refnamediv>
<refsect1 role="description">
@ -14,11 +14,10 @@
<void />
</methodsynopsis>
<para>
Marks the watcher as active. Note that only active watchers will receive
events.
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">
@ -29,37 +28,14 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.void;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>EvWatcher::start</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
/* ... */
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
...
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member></member>
<member><methodname>EvWatcher::stop</methodname></member>
</simplelist>
</refsect1>

View file

@ -4,7 +4,7 @@
<refentry xml:id="evwatcher.stop" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>EvWatcher::stop</refname>
<refpurpose>The stop purpose</refpurpose>
<refpurpose>Stops the watcher</refpurpose>
</refnamediv>
<refsect1 role="description">
@ -14,11 +14,10 @@
<void />
</methodsynopsis>
<para>
Marks the watcher as inactive. Note that only active watchers will receive
events.
</para>
&warn.undocumented.func;
</refsect1>
<refsect1 role="parameters">
@ -29,37 +28,15 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.void;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>EvWatcher::stop</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
/* ... */
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
...
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member></member>
<member><methodname>EvWatcher::start</methodname></member>
</simplelist>
</refsect1>