mirror of
https://github.com/danog/ext-uv.git
synced 2024-11-26 20:14:47 +01:00
fs_poll: check resource type
This commit is contained in:
parent
8569abc1f8
commit
1dd205fe12
@ -4,7 +4,7 @@ $poll = uv_fs_poll_init(uv_default_loop());
|
||||
uv_fs_poll_start($poll,function($rsc,$stat,$p){
|
||||
var_dump(1);
|
||||
var_dump($p);
|
||||
uv_fs_poll_stop($rsc);
|
||||
//uv_fs_poll_stop($rsc);
|
||||
|
||||
}, "/tmp/hoge", 1);
|
||||
|
||||
|
11
php_uv.c
11
php_uv.c
@ -6185,6 +6185,11 @@ PHP_FUNCTION(uv_fs_poll_start)
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(uv, php_uv_t *, &handle, -1, PHP_UV_RESOURCE_NAME, uv_resource_handle);
|
||||
|
||||
if (uv->type != IS_UV_FS_POLL) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "passed uv resource didn't initialize for uv_fs_poll");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
php_uv_cb_init(&cb, uv, &fci, &fcc, PHP_UV_FS_POLL_CB);
|
||||
uv->uv.fs_poll.data = uv;
|
||||
@ -6211,6 +6216,12 @@ PHP_FUNCTION(uv_fs_poll_stop)
|
||||
}
|
||||
|
||||
ZEND_FETCH_RESOURCE(uv, php_uv_t *, &poll, -1, PHP_UV_RESOURCE_NAME, uv_resource_handle);
|
||||
|
||||
if (uv->type != IS_UV_FS_POLL) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "passed uv resource didn't initialize for uv_fs_poll");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
uv_fs_poll_stop(&uv->uv.fs_poll);
|
||||
PHP_UV_DEBUG_RESOURCE_REFCOUNT(uv_fs_poll_stop, uv->resource_id);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user