2012-12-26 19:46:06 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<!-- $Revision$ -->
|
|
|
|
<refentry xml:id="evembed.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
|
|
<refnamediv>
|
|
|
|
<refname>EvEmbed::__construct</refname>
|
|
|
|
<refpurpose>Constructs the EvEmbed object</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
|
|
|
<methodsynopsis>
|
2012-12-27 17:33:55 +00:00
|
|
|
<modifier>public</modifier>
|
|
|
|
<methodname>EvEmbed::__construct</methodname>
|
|
|
|
<methodparam>
|
|
|
|
<type>object</type>
|
|
|
|
<parameter>other</parameter>
|
|
|
|
</methodparam>
|
|
|
|
<methodparam choice="opt">
|
|
|
|
<type>callable</type>
|
|
|
|
<parameter>callback</parameter>
|
|
|
|
</methodparam>
|
|
|
|
<methodparam choice="opt">
|
|
|
|
<type>mixed</type>
|
|
|
|
<parameter>data</parameter>
|
|
|
|
</methodparam>
|
|
|
|
<methodparam choice="opt">
|
|
|
|
<type>int</type>
|
|
|
|
<parameter>priority</parameter>
|
|
|
|
</methodparam>
|
2012-12-26 19:46:06 +00:00
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
2012-12-27 17:33:55 +00:00
|
|
|
This is a rather advanced watcher type that lets to embed one event loop
|
|
|
|
into another(currently only IO events are supported in the embedded loop,
|
|
|
|
other types of watchers might be handled in a delayed or incorrect fashion
|
|
|
|
and must not be used).
|
2012-12-26 19:46:06 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2012-12-27 17:33:55 +00:00
|
|
|
See
|
|
|
|
<link
|
2012-12-26 19:46:06 +00:00
|
|
|
xlink:href="http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#code_ev_embed_code_when_one_backend_">the
|
2012-12-27 17:33:55 +00:00
|
|
|
libev documentation</link>
|
|
|
|
for details.
|
2012-12-26 19:46:06 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
2012-12-27 17:33:55 +00:00
|
|
|
This watcher is most useful on
|
|
|
|
<emphasis>BSD</emphasis>
|
|
|
|
systems without working
|
|
|
|
<literal>kqueue</literal>
|
|
|
|
to still be able to handle a large number of sockets. See example below.
|
2012-12-26 19:46:06 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
2012-12-27 17:33:55 +00:00
|
|
|
<term>
|
|
|
|
<parameter>other</parameter>
|
|
|
|
</term>
|
2012-12-26 19:46:06 +00:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2012-12-27 17:33:55 +00:00
|
|
|
Instance of
|
|
|
|
<classname>EvLoop</classname>
|
|
|
|
. The loop to embed, this loop must be embeddable(see
|
|
|
|
<methodname>Ev::embeddableBackends</methodname>
|
|
|
|
).
|
2012-12-26 19:46:06 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
2012-12-27 17:33:55 +00:00
|
|
|
<term>
|
|
|
|
<parameter>callback</parameter>
|
|
|
|
</term>
|
2012-12-26 19:46:06 +00:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2012-12-27 17:33:55 +00:00
|
|
|
See
|
|
|
|
<link linkend="ev.watcher-callbacks">Watcher callbacks</link>
|
|
|
|
.
|
2012-12-26 19:46:06 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
2012-12-27 17:33:55 +00:00
|
|
|
<term>
|
|
|
|
<parameter>data</parameter>
|
|
|
|
</term>
|
2012-12-26 19:46:06 +00:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Custom data associated with the watcher.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
2012-12-27 17:33:55 +00:00
|
|
|
<term>
|
|
|
|
<parameter>priority</parameter>
|
|
|
|
</term>
|
2012-12-26 19:46:06 +00:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
<link linkend="ev.constants.watcher-pri">Watcher priority</link>
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
2012-12-27 17:33:55 +00:00
|
|
|
Returns EvEmbed object on success.
|
2012-12-26 19:46:06 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
|
|
|
<example>
|
2012-12-27 17:33:55 +00:00
|
|
|
<title>Embedding loop created with kqueue backend into the default loop</title>
|
|
|
|
<programlisting role="php">
|
2012-12-26 19:46:06 +00:00
|
|
|
<![CDATA[
|
|
|
|
<?php
|
|
|
|
/*
|
2012-12-27 17:38:15 +00:00
|
|
|
* Check if kqueue is available but not recommended and create a kqueue backend
|
|
|
|
* for use with sockets (which usually work with any kqueue implementation).
|
|
|
|
* Store the kqueue/socket-only event loop in loop_socket. (One might optionally
|
|
|
|
* use EVFLAG_NOENV, too)
|
|
|
|
*
|
|
|
|
* Example borrowed from
|
|
|
|
* http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#Examples_CONTENT-9
|
|
|
|
*/
|
2012-12-26 19:46:06 +00:00
|
|
|
$loop = EvLoop::defaultLoop();
|
|
|
|
$socket_loop = NULL;
|
|
|
|
$embed = NULL;
|
|
|
|
|
|
|
|
if (Ev::supportedBackends() & ~Ev::recommendedBackends() & Ev::BACKEND_KQUEUE) {
|
2012-12-27 17:38:15 +00:00
|
|
|
if (($socket_loop = new EvLoop(Ev::BACKEND_KQUEUE))) {
|
|
|
|
$embed = new EvEmbed($loop);
|
|
|
|
}
|
2012-12-26 19:46:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!$socket_loop) {
|
2012-12-27 17:38:15 +00:00
|
|
|
$socket_loop = $loop;
|
2012-12-26 19:46:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Now use $socket_loop for all sockets, and $loop for anything else
|
|
|
|
?>
|
|
|
|
]]>
|
2012-12-27 17:33:55 +00:00
|
|
|
</programlisting>
|
|
|
|
</example>
|
2012-12-26 19:46:06 +00:00
|
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
|
|
|
<simplelist>
|
2012-12-27 17:33:55 +00:00
|
|
|
<member>
|
|
|
|
<methodname>Ev::embeddableBackends</methodname>
|
|
|
|
</member>
|
2012-12-26 19:46:06 +00:00
|
|
|
</simplelist>
|
|
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
|
|
<!-- 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
|
|
|
|
-->
|