eio_get_event_stream

(PECL eio >= 0.3.1b)

eio_get_event_streamGet stream representing a variable used in internal communications with libeio

说明

eio_get_event_stream ( void ) : mixed

eio_get_event_stream() 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.

参数

此函数没有参数。

返回值

eio_get_event_stream() returns stream on success; otherwise, NULL

范例

Example #1 Using eio with libevent

<?php
function my_eio_poll($fd$events$arg) {
    
/* Some libevent regulation might go here .. */
    
if (eio_nreqs()) {
        
eio_poll();
    }
    
/* .. and here */
}

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"0750EIO_PRI_DEFAULT"my_res_cb""mkdir data");
/* some other eio_* calls here ... */


// set event flags
event_set($event$fdEV_READ /*| EV_PERSIST*/"my_eio_poll", array($event$base));

// set event base 
event_base_set($event$base);

// enable event
event_add($event);

// start event loop
event_base_loop($base);

/* The same will be available via buffered libevent interface */
?>

以上例程的输出类似于:

int(3)
int(0)
string(8) "nop data"
int(0)
string(10) "mkdir data"
相关文章
php variable handling 函数 dumps a string representation of an internal zend value to outputphp eio 函数 polls libeio until all requests proceededphp eio 函数 synchronize a file s in core state with storage devicephp eio 函数 get stream representing a variable used in internal communications with libeiophp eio 函数 returns number of not yet handled requestsphp eio 函数 set maximum number of requests processed in a pollphp frontbase 函数 get or set the database name used with a connectionphp gupnp 函数 sets up callback for variable change notificationphp variable handling 函数 检测变量是否是一个标量php maxdb 函数 returns a string representing the type of connection usedphp stream 函数 return a bucket object from the brigade for operating onphp stream 函数 create a new bucket for use on the current streamphp stream 函数 获取已注册的数据流过滤器列表php stream 函数 接受由 stream socket server 创建的套接字连接php svn 函数 creates and returns a stream that will be used to replacephp svn 函数 returns a stream to access the contents of a file from a given version of the fsphp variable handling 函数 输出或返回一个变量的字符串表示php imagickdraw returns an array representing the pattern of dashes and gaps used to stroke pathsphp sdo das relational 函数 returns the special root object in an otherwise empty data graph. used when creating a data graph from scratchphp zookeeper sets the stream to be used by the library for logging
关注编程学问公众号