Skip to content

Instantly share code, notes, and snippets.

@marinsagovac
Last active December 21, 2020 10:15
Show Gist options
  • Save marinsagovac/41f6580c7eb3738a16c2 to your computer and use it in GitHub Desktop.
Save marinsagovac/41f6580c7eb3738a16c2 to your computer and use it in GitHub Desktop.
PHP EIO Event example
<?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();
@RichardTMiles
Copy link

All I'm saying is their is not enough documentation on EIO. Thanks.

@marinsagovac
Copy link
Author

Thanks 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment