2012-12-26 19:46:06 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<!-- $Revision$ -->
|
|
|
|
<refentry xml:id="evtimer.createstopped" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>EvTimer::createStopped</refname>
|
2012-12-27 10:09:23 +00:00
|
|
|
<refpurpose>Creates EvTimer stopped watcher object</refpurpose>
|
2012-12-26 19:46:06 +00:00
|
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
|
|
|
<methodsynopsis>
|
2012-12-27 07:53:59 +00:00
|
|
|
<modifier>final</modifier>
|
2012-12-27 17:33:55 +00:00
|
|
|
<modifier>public</modifier>
|
|
|
|
<modifier>static</modifier>
|
|
|
|
<type>EvTimer</type>
|
|
|
|
<methodname>EvTimer::createStopped</methodname>
|
|
|
|
<methodparam>
|
2018-01-25 16:11:32 +00:00
|
|
|
<type>float</type>
|
2012-12-27 17:33:55 +00:00
|
|
|
<parameter>after</parameter>
|
|
|
|
</methodparam>
|
|
|
|
<methodparam>
|
2018-01-25 16:11:32 +00:00
|
|
|
<type>float</type>
|
2012-12-27 17:33:55 +00:00
|
|
|
<parameter>repeat</parameter>
|
|
|
|
</methodparam>
|
|
|
|
<methodparam>
|
|
|
|
<type>callable</type>
|
|
|
|
<parameter>callback</parameter>
|
|
|
|
</methodparam>
|
2012-12-27 10:09:23 +00:00
|
|
|
<methodparam
|
2012-12-27 17:33:55 +00:00
|
|
|
choice="opt">
|
|
|
|
<type>mixed</type>
|
|
|
|
<parameter>data</parameter>
|
|
|
|
<initializer>&null;</initializer>
|
|
|
|
</methodparam>
|
2012-12-27 10:09:23 +00:00
|
|
|
<methodparam
|
2012-12-27 17:33:55 +00:00
|
|
|
choice="opt">
|
|
|
|
<type>int</type>
|
|
|
|
<parameter>priority</parameter>
|
|
|
|
<initializer>0</initializer>
|
|
|
|
</methodparam>
|
2012-12-26 19:46:06 +00:00
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
2012-12-27 17:33:55 +00:00
|
|
|
Creates EvTimer stopped watcher object. Unlike
|
|
|
|
<methodname>EvTimer::__construct</methodname>
|
|
|
|
, this method doesn't start the watcher automatically.
|
2012-12-26 19:46:06 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
2012-12-27 17:33:55 +00:00
|
|
|
<term>
|
|
|
|
<parameter>after</parameter>
|
|
|
|
</term>
|
2012-12-26 19:46:06 +00:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2012-12-27 17:33:55 +00:00
|
|
|
Configures the timer to trigger after
|
|
|
|
<parameter>after</parameter>
|
|
|
|
seconds.
|
2012-12-26 19:46:06 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
2012-12-27 17:33:55 +00:00
|
|
|
<term>
|
|
|
|
<parameter>repeat</parameter>
|
|
|
|
</term>
|
2012-12-26 19:46:06 +00:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2012-12-27 17:33:55 +00:00
|
|
|
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.
|
2012-12-26 19:46:06 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
2012-12-27 17:33:55 +00:00
|
|
|
<term>
|
|
|
|
<parameter>callback</parameter>
|
|
|
|
</term>
|
2012-12-26 19:46:06 +00:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2012-12-27 17:33:55 +00:00
|
|
|
See
|
|
|
|
<link linkend="ev.watcher-callbacks">Watcher callbacks</link>
|
|
|
|
.
|
2012-12-26 19:46:06 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
2012-12-27 17:33:55 +00:00
|
|
|
<term>
|
|
|
|
<parameter>data</parameter>
|
|
|
|
</term>
|
2012-12-26 19:46:06 +00:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2012-12-27 10:09:23 +00:00
|
|
|
Custom data associated with the watcher.
|
2012-12-26 19:46:06 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
2012-12-27 17:33:55 +00:00
|
|
|
<term>
|
|
|
|
<parameter>priority</parameter>
|
|
|
|
</term>
|
2012-12-26 19:46:06 +00:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2012-12-27 10:09:23 +00:00
|
|
|
<link linkend="ev.constants.watcher-pri">Watcher priority</link>
|
2012-12-26 19:46:06 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
2012-12-27 17:33:55 +00:00
|
|
|
Returns EvTimer watcher object on success.
|
2012-12-26 19:46:06 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
2012-12-27 10:09:23 +00:00
|
|
|
<example>
|
2012-12-27 17:33:55 +00:00
|
|
|
<title>Monotor changes of /var/log/messages. Avoid missing updates by means of one second delay</title>
|
|
|
|
<programlisting role="php">
|
2012-12-26 19:46:06 +00:00
|
|
|
<![CDATA[
|
|
|
|
<?php
|
2012-12-27 10:09:23 +00:00
|
|
|
$timer = EvTimer::createStopped(0., 1.02, function ($w) {
|
2012-12-27 17:38:15 +00:00
|
|
|
$w->stop();
|
2012-12-27 10:09:23 +00:00
|
|
|
|
2012-12-27 17:38:15 +00:00
|
|
|
$stat = $w->data;
|
2012-12-26 19:46:06 +00:00
|
|
|
|
2012-12-27 17:38:15 +00:00
|
|
|
// 1 second after the most recent change of the file
|
|
|
|
printf("Current size: %ld\n", $stat->attr()['size']);
|
2012-12-27 10:09:23 +00:00
|
|
|
});
|
2012-12-26 19:46:06 +00:00
|
|
|
|
2012-12-27 10:09:23 +00:00
|
|
|
$stat = new EvStat("/var/log/messages", 0., function () use ($timer) {
|
2012-12-27 17:38:15 +00:00
|
|
|
// Reset timer watcher
|
|
|
|
$timer->again();
|
2012-12-27 10:09:23 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
$timer->data = $stat;
|
|
|
|
|
|
|
|
Ev::run();
|
2012-12-26 19:46:06 +00:00
|
|
|
?>
|
|
|
|
]]>
|
2012-12-27 17:33:55 +00:00
|
|
|
</programlisting>
|
|
|
|
</example>
|
2012-12-26 19:46:06 +00:00
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
|
|
|
<simplelist>
|
2012-12-27 17:33:55 +00:00
|
|
|
<member>
|
|
|
|
<methodname>EvTimer::__construct</methodname>
|
|
|
|
</member>
|
|
|
|
<member>
|
|
|
|
<classname>EvPeriodic</classname>
|
|
|
|
</member>
|
2012-12-26 19:46:06 +00:00
|
|
|
</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
|
|
|
|
-->
|