mirror of
https://github.com/danog/ext-uv.git
synced 2024-11-27 04:24:45 +01:00
30 lines
470 B
PHP
30 lines
470 B
PHP
--TEST--
|
|
Check for uv_timer_init and uv_timer_start
|
|
--FILE--
|
|
<?php
|
|
$loop = uv_default_loop();
|
|
$timer = uv_timer_init();
|
|
|
|
$i = 0;
|
|
uv_timer_start($timer, 10, 10, function($stat)
|
|
use (&$i, $timer, $loop) {
|
|
/* should I pass the timer parameter? */
|
|
|
|
echo "count: {$i}" . PHP_EOL;
|
|
$i++;
|
|
|
|
if ($i > 3) {
|
|
uv_timer_stop($timer);
|
|
uv_unref($timer);
|
|
}
|
|
});
|
|
|
|
uv_run();
|
|
|
|
echo "finished";
|
|
--EXPECT--
|
|
count: 0
|
|
count: 1
|
|
count: 2
|
|
count: 3
|
|
finished |