mirror of
https://github.com/danog/ext-uv.git
synced 2024-11-26 20:14:47 +01:00
Fix #50: bad fsevent example
This commit is contained in:
parent
7ff75d760d
commit
79d8aaa0bd
@ -1,10 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
$fsevent = uv_fs_event_init(uv_default_loop(),"/tmp/",function($rsc,$name,$event,$stat){
|
||||||
uv_fs_event_init(uv_default_loop(),"/tmp/",function($rsc,$name,$event,$stat){
|
var_dump($name, $event);
|
||||||
var_dump($name);
|
print PHP_EOL;
|
||||||
|
|
||||||
var_dump($event);
|
|
||||||
},0);
|
},0);
|
||||||
|
|
||||||
uv_run();
|
uv_run();
|
||||||
|
8
php_uv.c
8
php_uv.c
@ -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)
|
void static destruct_uv_loop(zend_object *obj)
|
||||||
{
|
{
|
||||||
uv_loop_t *loop = (uv_loop_t *) &((php_uv_loop_t *) obj)->loop;
|
php_uv_loop_t *loop_obj = (php_uv_loop_t *) obj;
|
||||||
if ((php_uv_loop_t *) obj != UV_G(default_loop)) {
|
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_stop(loop); /* in case we haven't stopped the loop yet otherwise ... */
|
||||||
uv_run(loop, UV_RUN_DEFAULT); /* invalidate the stop ;-) */
|
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_run(loop, UV_RUN_DEFAULT);
|
||||||
uv_loop_close(loop);
|
uv_loop_close(loop);
|
||||||
}
|
}
|
||||||
|
if (loop_obj->gc_buffer) {
|
||||||
|
efree(loop_obj->gc_buffer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void static clean_uv_handle(php_uv_t *uv) {
|
void static clean_uv_handle(php_uv_t *uv) {
|
||||||
|
@ -3,9 +3,9 @@ Check for fs event
|
|||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
define("DIRECTORY_PATH", dirname(__FILE__) . "/fixtures/example_directory");
|
define("DIRECTORY_PATH", dirname(__FILE__) . "/fixtures/example_directory");
|
||||||
/*
|
|
||||||
$ev = uv_fs_event_init(uv_default_loop(), dirname(DIRECTORY_PATH), function($rsc, $name, $event, $stat) {
|
$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);
|
uv_close($rsc);
|
||||||
}, 0);
|
}, 0);
|
||||||
|
|
||||||
@ -14,5 +14,5 @@ uv_fs_mkdir(uv_default_loop(), DIRECTORY_PATH, 0755, function($result) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
uv_run();
|
uv_run();
|
||||||
*/
|
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
|
string(17) "example_directory"
|
||||||
|
Loading…
Reference in New Issue
Block a user