diff --git a/frankenphp.c b/frankenphp.c index 605b481..e2b7bfa 100644 --- a/frankenphp.c +++ b/frankenphp.c @@ -738,9 +738,16 @@ static void *manager_thread(void *arg) { exit(EXIT_FAILURE); } + int num_threads = *((int *)arg); + free(arg); + arg = NULL; + #ifdef ZTS - // TODO: use tsrm_startup() directly as we know the number of expected threads +#if (PHP_VERSION_ID >= 80300) + php_tsrm_startup_ex(num_threads); +#else php_tsrm_startup(); +#endif /*tsrm_error_set(TSRM_ERROR_LEVEL_INFO, NULL);*/ #ifdef PHP_WIN32 ZEND_TSRMLS_CACHE_UPDATE(); @@ -761,9 +768,7 @@ static void *manager_thread(void *arg) { frankenphp_sapi_module.startup(&frankenphp_sapi_module); - threadpool thpool = thpool_init(*((int *)arg)); - free(arg); - arg = NULL; + threadpool thpool = thpool_init(num_threads); uintptr_t rh; while ((rh = go_fetch_request())) {