diff --git a/ext-src/stubs/php_swoole_thread.stub.php b/ext-src/stubs/php_swoole_thread.stub.php index 412d84d550..d6cf8b5d6c 100644 --- a/ext-src/stubs/php_swoole_thread.stub.php +++ b/ext-src/stubs/php_swoole_thread.stub.php @@ -10,7 +10,7 @@ public function detach(): bool {} public static function getArguments(): ?array {} public static function getId(): int {} - public static function getTsrmInfo(): array {} + public static function getInfo(): array {} public static function setName(string $name): bool {} #ifdef HAVE_CPU_AFFINITY diff --git a/ext-src/stubs/php_swoole_thread_arginfo.h b/ext-src/stubs/php_swoole_thread_arginfo.h index d5ce29cff6..2d6b3252bb 100644 --- a/ext-src/stubs/php_swoole_thread_arginfo.h +++ b/ext-src/stubs/php_swoole_thread_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: 5921b76860e0772b4970ee37ebdf397a6054a1e1 */ + * Stub hash: d3b07b5e94c81065bab39c16b70384c4572a00dc */ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Swoole_Thread___construct, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, script_file, IS_STRING, 0) @@ -19,7 +19,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Swoole_Thread_getId, 0, 0, IS_LONG, 0) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Swoole_Thread_getTsrmInfo, 0, 0, IS_ARRAY, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Swoole_Thread_getInfo, 0, 0, IS_ARRAY, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Swoole_Thread_setName, 0, 1, _IS_BOOL, 0) @@ -42,7 +42,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Swoole_Thread_setPriority, ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, policy, IS_LONG, 0, "0") ZEND_END_ARG_INFO() -#define arginfo_class_Swoole_Thread_getPriority arginfo_class_Swoole_Thread_getTsrmInfo +#define arginfo_class_Swoole_Thread_getPriority arginfo_class_Swoole_Thread_getInfo #if defined(__linux__) ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Swoole_Thread_gettid, 0, 0, IS_LONG, 0) diff --git a/ext-src/swoole_thread.cc b/ext-src/swoole_thread.cc index 4a391417c8..0d96bd670b 100644 --- a/ext-src/swoole_thread.cc +++ b/ext-src/swoole_thread.cc @@ -92,7 +92,7 @@ static PHP_METHOD(swoole_thread, joinable); static PHP_METHOD(swoole_thread, detach); static PHP_METHOD(swoole_thread, getArguments); static PHP_METHOD(swoole_thread, getId); -static PHP_METHOD(swoole_thread, getTsrmInfo); +static PHP_METHOD(swoole_thread, getInfo); static PHP_METHOD(swoole_thread, setName); #ifdef HAVE_CPU_AFFINITY static PHP_METHOD(swoole_thread, setAffinity); @@ -113,7 +113,7 @@ static const zend_function_entry swoole_thread_methods[] = { PHP_ME(swoole_thread, detach, arginfo_class_Swoole_Thread_detach, ZEND_ACC_PUBLIC) PHP_ME(swoole_thread, getArguments, arginfo_class_Swoole_Thread_getArguments, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(swoole_thread, getId, arginfo_class_Swoole_Thread_getId, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) - PHP_ME(swoole_thread, getTsrmInfo, arginfo_class_Swoole_Thread_getTsrmInfo, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) + PHP_ME(swoole_thread, getInfo, arginfo_class_Swoole_Thread_getInfo, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(swoole_thread, setName, arginfo_class_Swoole_Thread_setName, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) #ifdef HAVE_CPU_AFFINITY PHP_ME(swoole_thread, setAffinity, arginfo_class_Swoole_Thread_setAffinity, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) @@ -124,7 +124,6 @@ static const zend_function_entry swoole_thread_methods[] = { #ifdef __linux__ PHP_ME(swoole_thread, gettid, arginfo_class_Swoole_Thread_gettid, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) #endif - PHP_MALIAS(swoole_thread, info, getTsrmInfo, arginfo_class_Swoole_Thread_getTsrmInfo, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_FE_END }; // clang-format on @@ -559,7 +558,7 @@ void php_swoole_thread_php_socket_create(zval *return_value, zend_long sockfd) { } #endif -static PHP_METHOD(swoole_thread, getTsrmInfo) { +static PHP_METHOD(swoole_thread, getInfo) { array_init(return_value); add_assoc_bool(return_value, "is_main_thread", tsrm_is_main_thread()); add_assoc_bool(return_value, "is_shutdown", tsrm_is_shutdown()); diff --git a/tests/swoole_thread/info.phpt b/tests/swoole_thread/info.phpt index d10b88a114..08070ae460 100644 --- a/tests/swoole_thread/info.phpt +++ b/tests/swoole_thread/info.phpt @@ -17,13 +17,13 @@ Assert::eq(Thread::API_NAME, 'POSIX Threads'); $tm->parentFunc = function () { $thread = new Thread(__FILE__, 'child'); - $info = Thread::getTsrmInfo(); + $info = Thread::getInfo(); Assert::true($info['is_main_thread']); $thread->join(); }; $tm->childFunc = function () { - $info = Thread::getTsrmInfo(); + $info = Thread::getInfo(); Assert::false($info['is_main_thread']); };