(No version information available, might only be in Git)
Swoole\Event::cycle — Define a function to execute at the end of each event loop iteration
Defines a callback function to execute at the end (or beginning, if before is true) of each event loop iteration.
callbacknull to clear a previously set cycle function.
beforetrue, the callback executes before the event loop; if false, after.
Ejemplo #1 Basic usage
<?php
Swoole\Timer::tick(2000, function ($id) {
var_dump($id);
});
Swoole\Event::cycle(function () {
echo "hello [1]\n";
Swoole\Event::cycle(function () {
echo "hello [2]\n";
Swoole\Event::cycle(null);
});
});
Swoole\Event::wait();