1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
|
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<reference xml:id="class.event" role="class" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The Event class</title>
<titleabbrev>Event</titleabbrev>
<partintro>
<!-- {{{ Event intro -->
<section xml:id="event.intro">
&reftitle.intro;
<para>
<classname>Event</classname>
class represents and event firing on a file descriptor being ready to read
from or write to; a file descriptor becoming ready to read from or write
to(edge-triggered I/O only); a timeout expiring; a signal occurring; a
user-triggered event.
</para>
<para>
Every event is associated with
<classname>EventBase</classname>
. However, event will never fire until it is
<emphasis>added</emphasis>
(via
<methodname>Event::add</methodname>
). An added event remains in
<emphasis>pending</emphasis>
state until the registered event occurs, thus turning it to
<emphasis>active</emphasis>
state. To handle events user may register a callback which is called when
event becomes active. If event is configured
<emphasis>persistent</emphasis>
, it remains pending. If it is not persistent, it stops being pending when
it's callback runs.
<methodname>Event::del</methodname>
method
<emphasis>deletes</emphasis>
event, thus making it non-pending. By means of
<methodname>Event::add</methodname>
method it could be added again.
</para>
</section>
<!-- }}} -->
<section xml:id="event.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass>
<classname>Event</classname>
</ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<modifier>final</modifier>
<classname>Event</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">&Constants;</classsynopsisinfo>
<fieldsynopsis>
<modifier>const</modifier>
<type>int</type>
<varname linkend="event.constants.et">Event::ET</varname>
<initializer>32</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>int</type>
<varname linkend="event.constants.persist">Event::PERSIST</varname>
<initializer>16</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>int</type>
<varname linkend="event.constants.read">Event::READ</varname>
<initializer>2</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>int</type>
<varname linkend="event.constants.write">Event::WRITE</varname>
<initializer>4</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>int</type>
<varname linkend="event.constants.signal">Event::SIGNAL</varname>
<initializer>8</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>int</type>
<varname linkend="event.constants.timeout">Event::TIMEOUT</varname>
<initializer>1</initializer>
</fieldsynopsis>
<classsynopsisinfo role="comment">&Properties;</classsynopsisinfo>
<fieldsynopsis>
<modifier>public</modifier>
<modifier>readonly</modifier>
<type>bool</type>
<varname linkend="event.props.pending">pending</varname>
</fieldsynopsis>
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.event')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
</classsynopsis>
<!-- }}} -->
</section>
<!-- {{{ Event properties -->
<section xml:id="event.props">
&reftitle.properties;
<variablelist>
<varlistentry xml:id="event.props.pending">
<term>
<varname>pending</varname>
</term>
<listitem>
<para>
Whether event is pending. See
<link linkend="event.persistence">About event persistence</link>
.
</para>
</listitem>
</varlistentry>
</variablelist>
</section>
<!-- }}} -->
<!-- {{{ Event constants -->
<section xml:id="event.constants">
&reftitle.constants;
<variablelist>
<varlistentry xml:id="event.constants.et">
<term>
<constant>Event::ET</constant>
</term>
<listitem>
<para>
Indicates that the event should be edge-triggered, if the underlying
event base backend supports edge-triggered events. This affects the
semantics of
<constant>Event::READ</constant>
and
<constant>Event::WRITE</constant>
.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="event.constants.persist">
<term>
<constant>Event::PERSIST</constant>
</term>
<listitem>
<para>
Indicates that the event is persistent. See
<link linkend="event.persistence">About event persistence</link>
.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="event.constants.read">
<term>
<constant>Event::READ</constant>
</term>
<listitem>
<para>
This flag indicates an event that becomes active when the provided file
descriptor(usually a stream resource, or socket) is ready for reading.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="event.constants.write">
<term>
<constant>Event::WRITE</constant>
</term>
<listitem>
<para>
This flag indicates an event that becomes active when the provided file
descriptor(usually a stream resource, or socket) is ready for reading.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="event.constants.signal">
<term>
<constant>Event::SIGNAL</constant>
</term>
<listitem>
<para>
Used to implement signal detection. See "Constructing signal events"
below.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="event.constants.timeout">
<term>
<constant>Event::TIMEOUT</constant>
</term>
<listitem>
<para>
This flag indicates an event that becomes active after a timeout
elapses.
</para>
<para>
The
<constant>Event::TIMEOUT</constant>
flag is ignored when constructing an event: one can either set a
timeout when event is
<emphasis>added</emphasis>
, or not. It is set in the
<literal>$what</literal>
argument to the callback function when a timeout has occurred.
</para>
</listitem>
</varlistentry>
</variablelist>
</section>
<!-- }}} -->
</partintro>
&reference.event.entities.event;
</reference>
<!-- 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
-->
|