mirror of
https://github.com/awslabs/aws-crt-php.git
synced 2026-08-17 17:47:12 +00:00
Added EventLoopGroup API to native extension (#15)
This commit is contained in:
@@ -9,3 +9,7 @@ function aws_crt_error_name(int $error_code): string {}
|
||||
function aws_crt_error_str(int $error_code): string {}
|
||||
|
||||
function aws_crt_error_debug_str(int $error_code): string {}
|
||||
|
||||
function aws_crt_event_loop_group_new(int $max_threads): int {}
|
||||
|
||||
function aws_crt_event_loop_group_release(int $event_loop_group): void {}
|
||||
|
||||
+13
-1
@@ -1,5 +1,5 @@
|
||||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: a629a07df494f8ae6563949b2819c833e9d73f9a */
|
||||
* Stub hash: 04ff04fec5e4293918658ac98394d98387fa977b */
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_aws_crt_last_error, 0, 0, IS_LONG, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
@@ -12,11 +12,21 @@ ZEND_END_ARG_INFO()
|
||||
|
||||
#define arginfo_aws_crt_error_debug_str arginfo_aws_crt_error_name
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_aws_crt_event_loop_group_new, 0, 1, IS_LONG, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, max_threads, IS_LONG, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_aws_crt_event_loop_group_release, 0, 1, IS_VOID, 0)
|
||||
ZEND_ARG_TYPE_INFO(0, event_loop_group, IS_LONG, 0)
|
||||
ZEND_END_ARG_INFO()
|
||||
|
||||
|
||||
ZEND_FUNCTION(aws_crt_last_error);
|
||||
ZEND_FUNCTION(aws_crt_error_name);
|
||||
ZEND_FUNCTION(aws_crt_error_str);
|
||||
ZEND_FUNCTION(aws_crt_error_debug_str);
|
||||
ZEND_FUNCTION(aws_crt_event_loop_group_new);
|
||||
ZEND_FUNCTION(aws_crt_event_loop_group_release);
|
||||
|
||||
|
||||
static const zend_function_entry ext_functions[] = {
|
||||
@@ -24,5 +34,7 @@ static const zend_function_entry ext_functions[] = {
|
||||
ZEND_FE(aws_crt_error_name, arginfo_aws_crt_error_name)
|
||||
ZEND_FE(aws_crt_error_str, arginfo_aws_crt_error_str)
|
||||
ZEND_FE(aws_crt_error_debug_str, arginfo_aws_crt_error_debug_str)
|
||||
ZEND_FE(aws_crt_event_loop_group_new, arginfo_aws_crt_event_loop_group_new)
|
||||
ZEND_FE(aws_crt_event_loop_group_release, arginfo_aws_crt_event_loop_group_release)
|
||||
ZEND_FE_END
|
||||
};
|
||||
|
||||
@@ -81,6 +81,28 @@ PHP_FUNCTION(aws_crt_error_debug_str) {
|
||||
AWS_RETURN_STRING(aws_crt_error_debug_str(error_code));
|
||||
}
|
||||
|
||||
PHP_FUNCTION(aws_crt_event_loop_group_new) {
|
||||
zend_ulong num_threads = 0;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num_threads) == FAILURE) {
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
||||
struct aws_event_loop_group *elg = aws_crt_event_loop_group_new(num_threads);
|
||||
RETURN_LONG((zend_ulong)elg);
|
||||
}
|
||||
|
||||
PHP_FUNCTION(aws_crt_event_loop_group_release) {
|
||||
zend_ulong php_elg = 0;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &php_elg) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
struct aws_event_loop_group *elg = (void *)php_elg;
|
||||
aws_crt_event_loop_group_release(elg);
|
||||
}
|
||||
|
||||
zend_module_entry awscrt_module_entry = {
|
||||
STANDARD_MODULE_HEADER,
|
||||
"awscrt",
|
||||
|
||||
Reference in New Issue
Block a user