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
|
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 331229 $ -->
<phpdoc:classref xml:id="class.eventbase" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The EventBase class</title>
<titleabbrev>EventBase</titleabbrev>
<partintro>
<!-- {{{ EventBase intro -->
<section xml:id="eventbase.intro">
&reftitle.intro;
<para>
<classname>EventBase</classname>
class represents libevent's event base structure. It holds a set of events
and can poll to determine which events are active.
</para>
<para>
Each event base has a
<emphasis>method</emphasis>
, or a
<emphasis>backend</emphasis>
that it uses to determine which events are ready. The recognized methods
are:
<literal>select</literal>
,
<literal>poll</literal>
,
<literal>epoll</literal>
,
<literal>kqueue</literal>
,
<literal>devpoll</literal>
,
<literal>evport</literal>
and
<literal>win32</literal>
.
</para>
<para>
To configure event base to use, or avoid specific backend
<classname>EventConfig</classname>
class can be used.
</para>
<warning xml:id="eventbase.object-dtor-warning">
<para>
Do
<emphasis>NOT</emphasis>
destroy the
<classname>EventBase</classname>
object as long as resources of the associated
<literal>Event</literal>
objects are not released. Otherwise, it will lead to unpredictable
results!
</para>
</warning>
</section>
<!-- }}} -->
<section xml:id="eventbase.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass>
<classname>EventBase</classname>
</ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<modifier>final</modifier>
<classname>EventBase</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">Constants</classsynopsisinfo>
<fieldsynopsis>
<modifier>const</modifier>
<type>integer</type>
<varname linkend="eventbase.constants.loop-once">EventBase::LOOP_ONCE</varname>
<initializer>1</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>integer</type>
<varname linkend="eventbase.constants.loop-nonblock">EventBase::LOOP_NONBLOCK</varname>
<initializer>2</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>integer</type>
<varname linkend="eventbase.constants.nolock">EventBase::NOLOCK</varname>
<initializer>1</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>integer</type>
<varname linkend="eventbase.constants.startup-iocp">EventBase::STARTUP_IOCP</varname>
<initializer>4</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>integer</type>
<varname linkend="eventbase.constants.no-cache-time">EventBase::NO_CACHE_TIME</varname>
<initializer>8</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>integer</type>
<varname linkend="eventbase.constants.epoll-use-changelist">EventBase::EPOLL_USE_CHANGELIST</varname>
<initializer>16</initializer>
</fieldsynopsis>
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.eventbase')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
</classsynopsis>
<!-- }}} -->
</section>
<!-- {{{ EventBase constants -->
<section xml:id="eventbase.constants">
&reftitle.constants;
<variablelist>
<varlistentry xml:id="eventbase.constants.loop-once">
<term>
<constant>EventBase::LOOP_ONCE</constant>
</term>
<listitem>
<para>
Flag used with
<methodname>EventBase::loop</methodname>
method which means: "block until libevent has an active event, then
exit once all active events have had their callbacks run".
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="eventbase.constants.loop-nonblock">
<term>
<constant>EventBase::LOOP_NONBLOCK</constant>
</term>
<listitem>
<para>
Flag used with
<methodname>EventBase::loop</methodname>
method which means: "do not block: see which events are ready now, run
the callbacks of the highest-priority ones, then exit".
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="eventbase.constants.nolock">
<term>
<constant>EventBase::NOLOCK</constant>
</term>
<listitem>
<para>
Configuration flag. Do not allocate a lock for the event base, even if
we have locking set up".
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="eventbase.constants.startup-iocp">
<term>
<constant>EventBase::STARTUP_IOCP</constant>
</term>
<listitem>
<para>
Windows-only configuration flag. Enables the IOCP dispatcher at
startup.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="eventbase.constants.no-cache-time">
<term>
<constant>EventBase::NO_CACHE_TIME</constant>
</term>
<listitem>
<para>
Configuration flag. Instead of checking the current time every time the
event loop is ready to run timeout callbacks, check after each timeout
callback.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="eventbase.constants.epoll-use-changelist">
<term>
<constant>EventBase::EPOLL_USE_CHANGELIST</constant>
</term>
<listitem>
<para>
If we are using the
<literal>epoll</literal>
backend, this flag says that it is safe to use Libevent's internal
change-list code to batch up adds and deletes in order to try to do as
few syscalls as possible.
</para>
<para>
Setting this flag can make code run faster, but it may trigger a Linux
bug: it is not safe to use this flag if one has any fds cloned by
dup(), or its variants. Doing so will produce strange and
hard-to-diagnose bugs.
</para>
<para>
This flag can also be activated by settnig the
<literal>EVENT_EPOLL_USE_CHANGELIST</literal>
environment variable.
</para>
<para>
This flag has no effect if one winds up using a backend other than
<literal>epoll</literal>
.
</para>
</listitem>
</varlistentry>
</variablelist>
</section>
<!-- }}} -->
</partintro>
&reference.event.entities.eventbase;
</phpdoc:classref>
<!-- 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
-->
|