Fix #50: bad fsevent example

This commit is contained in:
Bob Weinand 2017-08-21 08:54:34 -04:00
parent 7ff75d760d
commit 79d8aaa0bd
3 changed files with 12 additions and 10 deletions

View File

@ -1,10 +1,8 @@
<?php
uv_fs_event_init(uv_default_loop(),"/tmp/",function($rsc,$name,$event,$stat){
var_dump($name);
var_dump($event);
$fsevent = uv_fs_event_init(uv_default_loop(),"/tmp/",function($rsc,$name,$event,$stat){
var_dump($name, $event);
print PHP_EOL;
},0);
uv_run();

View File

@ -1194,8 +1194,9 @@ static void destruct_uv_loop_walk_cb(uv_handle_t* handle, void* arg)
void static destruct_uv_loop(zend_object *obj)
{
uv_loop_t *loop = (uv_loop_t *) &((php_uv_loop_t *) obj)->loop;
if ((php_uv_loop_t *) obj != UV_G(default_loop)) {
php_uv_loop_t *loop_obj = (php_uv_loop_t *) obj;
uv_loop_t *loop = &loop_obj->loop;
if (loop_obj != UV_G(default_loop)) {
uv_stop(loop); /* in case we haven't stopped the loop yet otherwise ... */
uv_run(loop, UV_RUN_DEFAULT); /* invalidate the stop ;-) */
@ -1204,6 +1205,9 @@ void static destruct_uv_loop(zend_object *obj)
uv_run(loop, UV_RUN_DEFAULT);
uv_loop_close(loop);
}
if (loop_obj->gc_buffer) {
efree(loop_obj->gc_buffer);
}
}
void static clean_uv_handle(php_uv_t *uv) {

View File

@ -3,9 +3,9 @@ Check for fs event
--FILE--
<?php
define("DIRECTORY_PATH", dirname(__FILE__) . "/fixtures/example_directory");
/*
$ev = uv_fs_event_init(uv_default_loop(), dirname(DIRECTORY_PATH), function($rsc, $name, $event, $stat) {
echo "finished" . PHP_EOL;
var_dump($name);
uv_close($rsc);
}, 0);
@ -14,5 +14,5 @@ uv_fs_mkdir(uv_default_loop(), DIRECTORY_PATH, 0755, function($result) {
});
uv_run();
*/
--EXPECT--
string(17) "example_directory"