ext-uv/examples/idle.php

20 lines
303 B
PHP
Raw Normal View History

2012-05-28 18:31:18 +02:00
<?php
$loop = uv_default_loop();
$idle = uv_idle_init();
$i = 0;
2020-02-15 22:36:03 +01:00
uv_idle_start($idle, function($stat) use (&$i, $idle, $loop) {
2012-05-28 18:31:18 +02:00
echo "count: {$i}" . PHP_EOL;
$i++;
if ($i > 3) {
uv_idle_stop($idle);
2012-06-30 19:04:03 +02:00
uv_unref($idle);
2012-05-28 18:31:18 +02:00
}
sleep(1);
});
uv_run();
echo "finished";