<?php
Swoole\Event->cycle(callable $callback, bool $before = false)
callback function
before or after the event loop
if success, it returns TRUE, otherwise it returns FALSE.
Registe a callback function which is executed every loop.
<?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);
});
});