Last active
December 21, 2020 10:15
-
-
Save marinsagovac/41f6580c7eb3738a16c2 to your computer and use it in GitHub Desktop.
PHP EIO Event example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add eio so file in php.ini | |
var_dump(extension_loaded('eio')); | |
// sudo pecl install eio-1.2.5 | |
// add extension in php.ini extension=eio.so | |
/* Is called when eio_nop() finished */ | |
function my_nop_cb($data, $result) { | |
sleep(1); | |
echo "my_nop ", $data, "\n"; | |
sleep(2); | |
} | |
// 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(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
All I'm saying is their is not enough documentation on EIO. Thanks.