1
0
mirror of https://github.com/php/doc-ru.git synced 2026-03-26 00:32:15 +01:00
Files
archived-doc-ru/reference/ev/evtimer/createstopped.xml
Sergey Panteleev 6d43fd64d7 Исправление форматирования
[skip-spellcheck]
[skip-lint]
2022-12-27 03:42:36 +03:00

177 lines
4.9 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 508869e1df6458162c162d71669f5e81abd65d50 Maintainer: sergey Status: ready -->
<!-- Reviewed: no -->
<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>Создаёт остановленный наблюдатель EvTimer</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>final</modifier>
<modifier>public</modifier>
<modifier>static</modifier>
<type>EvTimer</type>
<methodname>EvTimer::createStopped</methodname>
<methodparam>
<type>float</type>
<parameter>after</parameter>
</methodparam>
<methodparam>
<type>float</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>
Создаёт остановленный наблюдатель EvTimer.
В отличие от <methodname>EvTimer::__construct</methodname>,
этот метод не запускает наблюдателя автоматически.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term>
<parameter>after</parameter>
</term>
<listitem>
<para>
Настраивает таймер для запуска через
<parameter>after</parameter> секунд.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>repeat</parameter>
</term>
<listitem>
<para>
Если время повтора равно <constant>0.0</constant>,
то он будет автоматически остановлен после истечения времени ожидания.
Если положительное, таймер будет автоматически настроен на повторный запуск
каждые повторяющиеся секунды, пока не будет остановлен вручную.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>callback</parameter>
</term>
<listitem>
<para>
Смотрите
<link linkend="ev.watcher-callbacks">Наблюдатели callback-функций</link>
.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>data</parameter>
</term>
<listitem>
<para>
Пользовательские данные, связанные с наблюдателем.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>priority</parameter>
</term>
<listitem>
<para>
<link linkend="ev.constants.watcher-pri">Приоритет наблюдателя</link>
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Возвращает объект наблюдателя EvTimer в случае успешного выполнения.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title>Следим за изменениями /var/log/messages. Избегаем пропущенные обновления с задержкой в одну секунду</title>
<programlisting role="php">
<![CDATA[
<?php
$timer = EvTimer::createStopped(0., 1.02, function ($w) {
$w->stop();
$stat = $w->data;
// 1 секунда после последнего изменения файла
printf("Текущий размер: %ld\n", $stat->attr()['size']);
});
$stat = new EvStat("/var/log/messages", 0., function () use ($timer) {
// Сброс таймера наблюдателя
$timer->again();
});
$timer->data = $stat;
Ev::run();
?>
]]>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member>
<methodname>EvTimer::__construct</methodname>
</member>
<member>
<classname>EvPeriodic</classname>
</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
-->