Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 2694

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Get stream representing a variable used in internal communications with libeio.</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.eio-futime.html">eio_futime</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.eio-get-last-error.html">eio_get_last_error</a></div>
 <div class="up"><a href="ref.eio.html">Eio Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.eio-get-event-stream" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">eio_get_event_stream</h1>
  <p class="verinfo">(PECL eio &gt;= 0.3.1b)</p><p class="refpurpose"><span class="refname">eio_get_event_stream</span> &mdash; <span class="dc-title">Get stream representing a variable used in internal communications with libeio.</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.eio-get-event-stream-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><strong>eio_get_event_stream</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

  <p class="para rdfs-comment">
    <span class="function"><strong>eio_get_event_stream()</strong></span> acquires stream representing a
   variable used in internal communications with libeio. Could be used to bind
   with some event loop provided by other PECL extension, for example
   libevent.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.eio-get-event-stream-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">This function has no parameters.</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.eio-get-event-stream-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
    <span class="function"><strong>eio_get_event_stream()</strong></span> returns stream on success;
   otherwise, <strong><code>NULL</code></strong>
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.eio-get-event-stream-examples">
  <h3 class="title">Examples</h3>
  <div class="example" id="example-3591">
   <p><strong>Example #1 Using eio with libevent</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">my_eio_poll</span><span style="color: #007700">(</span><span style="color: #0000BB">$fd</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$events</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$arg</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">/*&nbsp;Some&nbsp;libevent&nbsp;regulation&nbsp;might&nbsp;go&nbsp;here&nbsp;..&nbsp;*/<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">eio_nreqs</span><span style="color: #007700">())&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">eio_poll</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">/*&nbsp;..&nbsp;and&nbsp;here&nbsp;*/<br /></span><span style="color: #007700">}<br /><br />function&nbsp;</span><span style="color: #0000BB">my_res_cb</span><span style="color: #007700">(</span><span style="color: #0000BB">$d</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$r</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$r</span><span style="color: #007700">);&nbsp;</span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$d</span><span style="color: #007700">);<br />}<br /><br /></span><span style="color: #0000BB">$base&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">event_base_new</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$event&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">event_new</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">$fd&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">eio_get_event_stream</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$fd</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">eio_nop</span><span style="color: #007700">(</span><span style="color: #0000BB">EIO_PRI_DEFAULT</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"my_res_cb"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"nop&nbsp;data"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">eio_mkdir</span><span style="color: #007700">(</span><span style="color: #DD0000">"/tmp/abc-eio-temp"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0750</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">EIO_PRI_DEFAULT</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"my_res_cb"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"mkdir&nbsp;data"</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">/*&nbsp;some&nbsp;other&nbsp;eio_*&nbsp;calls&nbsp;here&nbsp;...&nbsp;*/<br /><br /><br />//&nbsp;set&nbsp;event&nbsp;flags<br /></span><span style="color: #0000BB">event_set</span><span style="color: #007700">(</span><span style="color: #0000BB">$event</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$fd</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">EV_READ&nbsp;</span><span style="color: #FF8000">/*|&nbsp;EV_PERSIST*/</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"my_eio_poll"</span><span style="color: #007700">,&nbsp;array(</span><span style="color: #0000BB">$event</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$base</span><span style="color: #007700">));<br /><br /></span><span style="color: #FF8000">//&nbsp;set&nbsp;event&nbsp;base&nbsp;<br /></span><span style="color: #0000BB">event_base_set</span><span style="color: #007700">(</span><span style="color: #0000BB">$event</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$base</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;enable&nbsp;event<br /></span><span style="color: #0000BB">event_add</span><span style="color: #007700">(</span><span style="color: #0000BB">$event</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;start&nbsp;event&nbsp;loop<br /></span><span style="color: #0000BB">event_base_loop</span><span style="color: #007700">(</span><span style="color: #0000BB">$base</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">/*&nbsp;The&nbsp;same&nbsp;will&nbsp;be&nbsp;available&nbsp;via&nbsp;buffered&nbsp;libevent&nbsp;interface&nbsp;*/<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

   <div class="example-contents"><p>The above example will output
something similar to:</p></div>
   <div class="example-contents screen">
<div class="cdata"><pre>
int(3)
int(0)
string(8) &quot;nop data&quot;
int(0)
string(10) &quot;mkdir data&quot;
</pre></div>
   </div>
  </div>
 </div>



</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.eio-futime.html">eio_futime</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.eio-get-last-error.html">eio_get_last_error</a></div>
 <div class="up"><a href="ref.eio.html">Eio Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>