(PECL eio >= 0.0.1dev)
eio_cancel — Cancels a request
$req
): void
eio_cancel() cancels a request specified by
req
req
The request resource
pri
請求的優(yōu)先級:EIO_PRI_DEFAULT
,EIO_PRI_MIN
,EIO_PRI_MAX
或 null
。如果是
null
,pri
將設為
EIO_PRI_DEFAULT
。
callback
callback
函數在請求完成時被調用。其應匹配一下原型:
void callback(mixed $data, int $result[, resource $req]);
data
傳遞給請求的用戶數據。
result
針對請求的結果的值。通常是相應的系統調用返回的值。
req
可選的請求資源,可被 eio_get_last_error() 之類的函數使用。
data
Arbitrary variable passed to callback
.
沒有返回值。
示例 #1 eio_cancel() example
<?php
/* Is called when eio_nop() finished */
function my_nop_cb($data, $result) {
echo "my_nop ", $data, "\n";
}
// This eio_nop() call will be cancelled
$req = eio_nop(EIO_PRI_DEFAULT, "my_nop_cb", "1");
var_dump($req);
eio_cancel($req);
// This time eio_nop() will be processed
eio_nop(EIO_PRI_DEFAULT, "my_nop_cb", "2");
// Process requests
eio_event_loop();
?>
以上例程的輸出類似于:
resource(4) of type (EIO Request Descriptor) my_nop 2