2012-12-26 19:46:06 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<!-- $Revision$ -->
|
|
|
|
|
|
|
|
<refentry xml:id="evsignal.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>EvSignal::__construct</refname>
|
2012-12-27 06:41:57 +00:00
|
|
|
<refpurpose>Constructs EvPeriodic watcher object</refpurpose>
|
2012-12-26 19:46:06 +00:00
|
|
|
</refnamediv>
|
|
|
|
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
|
|
|
<methodsynopsis>
|
|
|
|
<modifier>public</modifier> <methodname>EvSignal::__construct</methodname>
|
2012-12-27 06:41:57 +00:00
|
|
|
<methodparam><type>int</type><parameter>signum</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>
|
2012-12-26 19:46:06 +00:00
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
2012-12-27 16:33:36 +00:00
|
|
|
Constructs EvPeriodic watcher object and starts it automatically. For a
|
|
|
|
stopped periodic watcher consider using
|
|
|
|
<methodname>EvSignal::createStopped</methodname> method.
|
2012-12-26 19:46:06 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>signum</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2012-12-27 16:33:36 +00:00
|
|
|
Signal number. See constants exported by <emphasis>pcntl</emphasis>
|
2012-12-27 06:41:57 +00:00
|
|
|
extension. See also <literal>signal(7)</literal> man page.
|
2012-12-26 19:46:06 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>callback</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2012-12-27 06:41:57 +00:00
|
|
|
See <link linkend="ev.watcher-callbacks">Watcher callbacks</link>.
|
2012-12-26 19:46:06 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>data</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2012-12-27 06:41:57 +00:00
|
|
|
Custom data associated with the watcher.
|
2012-12-26 19:46:06 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>priority</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2012-12-27 06:41:57 +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 06:41:57 +00:00
|
|
|
Returns EvSignal object on success.
|
2012-12-26 19:46:06 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
2012-12-27 06:41:57 +00:00
|
|
|
<example>
|
|
|
|
<title>Handle SIGTERM signal</title>
|
|
|
|
<programlisting role="php">
|
2012-12-26 19:46:06 +00:00
|
|
|
<![CDATA[
|
|
|
|
<?php
|
2012-12-27 06:41:57 +00:00
|
|
|
$w = new EvSignal(SIGTERM, function ($watcher) {
|
2012-12-27 14:48:05 +00:00
|
|
|
echo "SIGTERM received\n";
|
|
|
|
$watcher->stop();
|
2012-12-27 06:41:57 +00:00
|
|
|
});
|
2012-12-27 14:48:05 +00:00
|
|
|
|
2012-12-27 06:41:57 +00:00
|
|
|
Ev::run();
|
2012-12-26 19:46:06 +00:00
|
|
|
?>
|
|
|
|
]]>
|
2012-12-27 06:41:57 +00:00
|
|
|
</programlisting>
|
|
|
|
</example>
|
2012-12-26 19:46:06 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
|
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
|
|
|
<simplelist>
|
2012-12-27 06:41:57 +00:00
|
|
|
<member><methodname>EvSignal::createStopped</methodname></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
|
|
|
|
-->
|