-
Notifications
You must be signed in to change notification settings - Fork 152
/
eio-get-event-stream.xml
121 lines (103 loc) · 2.95 KB
/
eio-get-event-stream.xml
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
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: dd07341fae2c414adc1f700be0890ff32e8daab4 Maintainer: yannick Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="function.eio-get-event-stream" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>eio_get_event_stream</refname>
<refpurpose>Récupère le flux représentant une variable utilisée dans les communications internes avec libeio</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>mixed</type><methodname>eio_get_event_stream</methodname>
<void />
</methodsynopsis>
<para>
<function>eio_get_event_stream</function> récupère un flux représentant
une variable utilisée dans les communications internes avec libeio.
Peut être utilisé pour lier avec des boucles d'événements fournies
par d'autres extensions PECL, comme par exemple
libevent.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
<function>eio_get_event_stream</function> retourne un flux en
cas de succès, &null; sinon.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title>Utilisation de eio avec libevent</title>
<programlisting role="php">
<![CDATA[
<?php
function my_eio_poll($fd, $events, $arg) {
/* Quelques commandes libevent peuvent être effectuées ici .. */
if (eio_nreqs()) {
eio_poll();
}
/* .. et ici */
}
function my_res_cb($d, $r) {
var_dump($r); var_dump($d);
}
$base = event_base_new();
$event = event_new();
$fd = eio_get_event_stream();
var_dump($fd);
eio_nop(EIO_PRI_DEFAULT, "my_res_cb", "nop data");
eio_mkdir("/tmp/abc-eio-temp", 0750, EIO_PRI_DEFAULT, "my_res_cb", "mkdir data");
/* quelques appels à eio_* calls ici ... */
// Définit les drapeaux des événements
event_set($event, $fd, EV_READ /*| EV_PERSIST*/, "my_eio_poll", array($event, $base));
// Définit l'événement de base
event_base_set($event, $base);
// Active l'événement
event_add($event);
// Démarre la boucle des événements
event_base_loop($base);
/* La même chose peut être effectuée avec les interfaces libevent bufferisées */
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
int(3)
int(0)
string(8) "nop data"
int(0)
string(10) "mkdir data"
]]>
</screen>
</example>
</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
-->