Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions reference/event/book.xml
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<book xml:id="book.event" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<book xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="book.event">
<?phpdoc extension-membership="pecl" ?>
<title>Event</title>
<titleabbrev>Event</titleabbrev>
<preface xml:id="intro.event">
&reftitle.intro;
<para>
<simpara>
This is an extension to efficiently schedule I/O, time and signal based
events using the best I/O notification mechanism available for specific
platform. This is a port of libevent to the PHP infrastructure.
</para>
</simpara>
<note xmlns="http://docbook.org/ns/docbook">
<para>
<simpara>
Note, Windows support introduced in
<literal>event-1.9.0</literal>.
</para>
</simpara>
</note>
<para>
<simpara>
Version
<emphasis>1.0.0</emphasis>
introduces new object-oriented API (breaking backwards compatibility), and
support of libevent 2+ including HTTP, DNS, OpenSSL and the event listener.
</para>
</simpara>
<note xmlns="http://docbook.org/ns/docbook">
<para>
<simpara>
Note,
<literal>event-1.0.0</literal>
and greater is not compatible with previous versions.
</para>
</simpara>
</note>
</preface>
&reference.event.setup;
Expand Down
6 changes: 3 additions & 3 deletions reference/event/configure.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<section xml:id="event.installation" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<section xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="event.installation">
&reftitle.install;

<para>
<simpara>
&pecl.info;
<link xlink:href="&url.pecl.package;event">&url.pecl.package;event</link>
</para>
</simpara>
</section>
<!-- Keep this comment at the end of the file
Local variables:
Expand Down
40 changes: 20 additions & 20 deletions reference/event/event.callbacks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!-- $Revision$ -->
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="event.callbacks">
<title>Event callbacks</title>
<para>
<simpara>
If a callback is registered for an event, it will be called when the event
becomes active. To associate a callback with event one can pass a
<type>callable</type>
Expand All @@ -12,10 +12,10 @@
<methodname>Event::set</methodname>,
or one of the factory methods like
<methodname>Event::timer</methodname>.
</para>
<para>
</simpara>
<simpara>
An event callback should match the following prototype:
</para>
</simpara>
<methodsynopsis>
<type>void</type>
<methodname>callback</methodname>
Expand All @@ -40,41 +40,41 @@
<parameter>fd</parameter>
</term>
<listitem>
<para>
<simpara>
The file descriptor, stream resource or socket associated with the
event. For signal event
<parameter>fd</parameter>
is equal to the signal number.
</para>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>what</parameter>
</term>
<listitem>
<para>
<simpara>
Bit mask of
<emphasis>all</emphasis>
events triggered.
</para>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>arg</parameter>
</term>
<listitem>
<para>
<simpara>
User custom data.
</para>
</simpara>
</listitem>
</varlistentry>
</variablelist>
<para>
<simpara>
<methodname>Event::timer</methodname>
expects the callback to match the following prototype:
</para>
</simpara>
<methodsynopsis>
<type>void</type>
<methodname>callback</methodname>
Expand All @@ -90,16 +90,16 @@
<parameter>arg</parameter>
</term>
<listitem>
<para>
<simpara>
User custom data.
</para>
</simpara>
</listitem>
</varlistentry>
</variablelist>
<para>
<simpara>
<methodname>Event::signal</methodname>
expects the callback to match the following prototype:
</para>
</simpara>
<methodsynopsis>
<type>void</type>
<methodname>callback</methodname>
Expand All @@ -119,21 +119,21 @@
<parameter>signum</parameter>
</term>
<listitem>
<para>
<simpara>
The number of the triggered signal(e.g.
<constant>SIGTERM</constant>
).
</para>
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>arg</parameter>
</term>
<listitem>
<para>
<simpara>
User custom data.
</para>
</simpara>
</listitem>
</varlistentry>
</variablelist>
Expand Down
19 changes: 9 additions & 10 deletions reference/event/event.constructing.signal.events.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<chapter xml:id="event.constructing.signal.events" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="event.constructing.signal.events">
<title>Constructing signal events</title>
<para>
<simpara>
Event can also watch for POSIX-style signals. To construct a handler for a
signal, use
<methodname>Event::__construct</methodname>
Expand All @@ -11,7 +11,7 @@
flag, or
<methodname>Event::signal</methodname>
factory method.
</para>
</simpara>
<example>
<title>Handling <literal>SIGTERM</literal> signal</title>
<programlisting role="php">
Expand Down Expand Up @@ -56,19 +56,18 @@ $base->loop();
]]>
</programlisting>
</example>
<para>
<simpara>
Note that signal callbacks are run in the event loop after the signal
occurs, so it is safe for them to call functions that you are not supposed
to call from a regular POSIX signal handler.
</para>
<para></para>
<para>
</simpara>
<simpara/>
<simpara>
See also
<link
xlink:href="http://www.wangafu.net/~nickm/libevent-book/Ref4_event.html#_constructing_signal_events">Fast
<link xlink:href="http://www.wangafu.net/~nickm/libevent-book/Ref4_event.html#_constructing_signal_events">Fast
portable non-blocking network programming with Libevent, Constructing Signal
Events</link>.
</para>
</simpara>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
Expand Down
25 changes: 12 additions & 13 deletions reference/event/event.flags.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<chapter xml:id="event.flags" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="event.flags">
<title>Event flags</title>
<para>
<simpara>
<constant>Event::READ</constant>
This flag indicates an event that becomes active when the provided file
descriptor (usually a stream resource, or socket) is ready for reading.
</para>
<para>
</simpara>
<simpara>
<constant>Event::WRITE</constant>
flag indicates an event that becomes active when the provided file
descriptor (usually a stream resource, or socket) is ready for writing.
</para>
<para>
</simpara>
<simpara>
<constant>Event::SIGNAL</constant>
used to implement signal detection. See "Constructing signal events" below.
</para>
<para>
</simpara>
<simpara>
<constant>Event::TIMEOUT</constant>
indicates an event that becomes active after a timeout elapses. The
<constant>Event::TIMEOUT</constant>
Expand All @@ -26,14 +26,13 @@
or not. It is set in the
<literal>$what</literal>
argument to the callback function when a timeout has occurred.
</para>
<para>
</simpara>
<simpara>
See also
<link
xlink:href="http://www.wangafu.net/~nickm/libevent-book/Ref4_event.html#_the_event_flags">Fast
<link xlink:href="http://www.wangafu.net/~nickm/libevent-book/Ref4_event.html#_the_event_flags">Fast
portable non-blocking network programming with Libevent, Working with events,
Event flags</link>
</para>
</simpara>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
Expand Down
29 changes: 14 additions & 15 deletions reference/event/event.persistence.xml
Original file line number Diff line number Diff line change
@@ -1,51 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<chapter xml:id="event.persistence" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="event.persistence">
<title>About event persistence</title>
<para>
<simpara>
By default, whenever a pending event becomes active (because its file
descriptor is ready to read or write, or because its timeout expires), it
becomes non-pending right before its callback is executed. Thus, to make the
event pending again one may call
<methodname>Event::add</methodname>
on it again from inside the callback function.
</para>
<para>
</simpara>
<simpara>
If the
<constant>Event::PERSIST</constant>
flag is set on an event, however, the event is
<emphasis>persistent</emphasis>.
This means that event remains pending even when its callback is activated.
<methodname>Event::del</methodname>
method can be called to make it non-pending.
</para>
<para>
</simpara>
<simpara>
The timeout on a persistent event resets whenever the event's callback runs.
Thus, if one has an event with flags
<constant>Event::READ</constant>
<literal>|</literal>
<constant>Event::PERSIST</constant>
and a timeout of five seconds, the event will become active:
</para>
</simpara>
<orderedlist>
<listitem>
<para>
<simpara>
Whenever the socket or file descriptor is ready for reading.
</para>
</simpara>
</listitem>
<listitem>
<para>
<simpara>
Whenever five seconds have passed since the event last became active.
</para>
</simpara>
</listitem>
</orderedlist>
<para>
<simpara>
See also
<link
xlink:href="http://www.wangafu.net/~nickm/libevent-book/Ref4_event.html#_about_event_persistence">Fast
<link xlink:href="http://www.wangafu.net/~nickm/libevent-book/Ref4_event.html#_about_event_persistence">Fast
portable non-blocking network programming with Libevent, About Event
Persistence</link>
</para>
</simpara>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
Expand Down
Loading
Loading