1
0
mirror of https://github.com/php/doc-en.git synced 2026-03-23 23:32:18 +01:00
Files
archived-doc-en/reference/event/eventbufferevent.about.callbacks.xml

148 lines
3.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="eventbufferevent.about.callbacks">
<title>About buffer event callbacks</title>
<para>
An object of
<classname>EventBufferEvent</classname>
class represents a
<emphasis>buffer event</emphasis>.
The asynchronous nature of I/O performed by Libevent implies that a
socket(or other kind of file descriptor) is not always available. Event
invokes corresponding callbacks when the resource becomes available for
reading or writing, or when some event occurs(e.g. error, "end of line"
etc.).
</para>
<para>
Read and write callbacks should match the following prototype:
</para>
<methodsynopsis>
<type>void</type>
<methodname>callback</methodname>
<methodparam choice="opt">
<type>EventBufferEvent</type>
<parameter>bev</parameter>
<initializer>&null;</initializer>
</methodparam>
<methodparam choice="opt">
<type>mixed</type>
<parameter>arg</parameter>
<initializer>&null;</initializer>
</methodparam>
</methodsynopsis>
<variablelist>
<varlistentry>
<term>
<parameter>bev</parameter>
</term>
<listitem>
<para>
Associated
<classname>EventBufferEvent</classname>
object.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>arg</parameter>
</term>
<listitem>
<para>
Custom variable attached to all callbacks via
<methodname>EventBufferEvent::__construct</methodname>,
or
<methodname>EventBufferEvent::setCallbacks</methodname>.
</para>
</listitem>
</varlistentry>
</variablelist>
<para>
Event callback should match the following prototype:
</para>
<methodsynopsis>
<type>void</type>
<methodname>callback</methodname>
<methodparam choice="opt">
<type>EventBufferEvent</type>
<parameter>bev</parameter>
<initializer>&null;</initializer>
</methodparam>
<methodparam choice="opt">
<type>int</type>
<parameter>events</parameter>
<initializer>0</initializer>
</methodparam>
<methodparam choice="opt">
<type>mixed</type>
<parameter>arg</parameter>
<initializer>&null;</initializer>
</methodparam>
</methodsynopsis>
<variablelist>
<varlistentry>
<term>
<parameter>bev</parameter>
</term>
<listitem>
<para>
Associated
<classname>EventBufferEvent</classname>
object.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>events</parameter>
</term>
<listitem>
<para>
Bit mask of events:
<constant>EventBufferEvent::READING</constant>,
<constant>EventBufferEvent::WRITING</constant>,
<constant>EventBufferEvent::EOL</constant>,
<constant>EventBufferEvent::ERROR</constant>
and
<constant>EventBufferEvent::TIMEOUT</constant>.
See
<link linkend="eventbufferevent.constants">EventBufferEvent constants</link>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>arg</parameter>
</term>
<listitem>
<para>
Custom variable attached to all callbacks via
<methodname>EventBufferEvent::__construct</methodname>,
or
<methodname>EventBufferEvent::setCallbacks</methodname>.
</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
-->