mirror of
https://github.com/php/doc-es.git
synced 2026-03-23 23:12:09 +01:00
145 lines
3.9 KiB
XML
145 lines
3.9 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: a47dff201e3f65c07f6c84a535951632771cf72d Maintainer: PhilDaiguille Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="event.callbacks">
|
|
<title>Funciones de retrollamada de eventos</title>
|
|
<para>
|
|
Si una función de retrollamada está registrada para un evento, será llamada cuando el evento se active. Para asociar una función de retrollamada con un evento, se debe pasar con un tipo <type>callable</type> al método <methodname>Event::__construct</methodname>, <methodname>Event::set</methodname>, o cualquier otro método factorial como <methodname>Event::timer</methodname>.
|
|
</para>
|
|
<para>
|
|
Una función de retrollamada de evento debe corresponder al siguiente prototipo:
|
|
</para>
|
|
<methodsynopsis>
|
|
<type>void</type>
|
|
<methodname>callback</methodname>
|
|
<methodparam choice="opt">
|
|
<type>mixed</type>
|
|
<parameter>fd</parameter>
|
|
<initializer>&null;</initializer>
|
|
</methodparam>
|
|
<methodparam choice="opt">
|
|
<type>int</type>
|
|
<parameter>what</parameter>
|
|
</methodparam>
|
|
<methodparam choice="opt">
|
|
<type>mixed</type>
|
|
<parameter>arg</parameter>
|
|
<initializer>&null;</initializer>
|
|
</methodparam>
|
|
</methodsynopsis>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>fd</parameter>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Un descriptor de fichero, un recurso de flujo, o un socket asociado con el evento. Para los eventos de tipo señal, <parameter>fd</parameter> corresponde al número de la señal.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>what</parameter>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Máscara de bits de <emphasis>todos</emphasis> los eventos lanzados.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>arg</parameter>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Datos de usuario personalizados.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
<para>
|
|
El método <methodname>Event::timer</methodname> espera una función de retrollamada que corresponda al siguiente prototipo:
|
|
</para>
|
|
<methodsynopsis>
|
|
<type>void</type>
|
|
<methodname>callback</methodname>
|
|
<methodparam choice="opt">
|
|
<type>mixed</type>
|
|
<parameter>arg</parameter>
|
|
<initializer>&null;</initializer>
|
|
</methodparam>
|
|
</methodsynopsis>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>arg</parameter>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Datos de usuario personalizados.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
<para>
|
|
El método <methodname>Event::signal</methodname> espera una función de retrollamada que corresponda al siguiente prototipo:
|
|
</para>
|
|
<methodsynopsis>
|
|
<type>void</type>
|
|
<methodname>callback</methodname>
|
|
<methodparam choice="opt">
|
|
<type>int</type>
|
|
<parameter>signum</parameter>
|
|
</methodparam>
|
|
<methodparam choice="opt">
|
|
<type>mixed</type>
|
|
<parameter>arg</parameter>
|
|
<initializer>&null;</initializer>
|
|
</methodparam>
|
|
</methodsynopsis>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>signum</parameter>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
El número de la señal lanzada (i.e. <constant>SIGTERM</constant>).
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>arg</parameter>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Datos de usuario personalizados.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</chapter>
|
|
<!-- 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
|
|
-->
|