EIO_CANCEL(3) 1 EIO_CANCEL(3)
eio_cancel - Cancels a request
SYNOPSIS
void eio_cancel (resource $req)
DESCRIPTION
eio_cancel(3) cancels a request specified by $req
PARAMETERS
o $req
- The request resource
o $pri
-The request priority: EIO_PRI_DEFAULT, EIO_PRI_MIN, EIO_PRI_MAX, or NULL. If NULL passed, $pri internally is set to
EIO_PRI_DEFAULT.
o $callback
-$callback function is called when the request is done. It should match the following prototype:
void callback(mixed $data, int $result[, resource $req]);
o $data
-is custom data passed to the request.
o $result
-request-specific result value; basically, the value returned by corresponding system call.
o $req
-is optional request resource which can be used with functions like eio_get_last_error(3)
o $data
- Arbitrary variable passed to $callback.
RETURN VALUES
No value is returned.
EXAMPLES
Example #1
eio_cancel(3) example
<?php
/* Is called when eio_nop() finished */
function my_nop_cb($data, $result) {
echo "my_nop ", $data, "
";
}
// 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();
?>
The above example will output something similar to:
resource(4) of type (EIO Request Descriptor)
my_nop 2
SEE ALSO eio_grp_cancel.
PHP Documentation Group EIO_CANCEL(3)