diff --git a/compiler/pipes/register-kphp-configuration.cpp b/compiler/pipes/register-kphp-configuration.cpp index ec6abfec13..8c9e06b652 100644 --- a/compiler/pipes/register-kphp-configuration.cpp +++ b/compiler/pipes/register-kphp-configuration.cpp @@ -141,7 +141,7 @@ void RegisterKphpConfiguration::handle_constant_runtime_options(const ClassMembe register_net_dc_mask(opt_pair->value()); } else if (vk::any_of_equal(*opt_key, warmup_workers_part_key_, warmup_instance_cache_elements_part_key_, warmup_timeout_sec_key_, - oom_handling_memory_ratio_key_/*, thread_pool_ratio_key_*/)) { + oom_handling_memory_ratio_key_, thread_pool_ratio_key_)) { generic_register_simple_option(opt_pair->value(), *opt_key); } else { kphp_error(0, fmt_format("Got unexpected option {}::{}['{}']", diff --git a/compiler/pipes/register-kphp-configuration.h b/compiler/pipes/register-kphp-configuration.h index 1c45639535..ddd476dc7b 100644 --- a/compiler/pipes/register-kphp-configuration.h +++ b/compiler/pipes/register-kphp-configuration.h @@ -43,7 +43,7 @@ class RegisterKphpConfiguration final : public SyncPipeF { const vk::string_view oom_handling_memory_ratio_key_{"--oom-handling-memory-ratio"}; -// const vk::string_view thread_pool_ratio_key_{"--thread-pool-ratio"}; + const vk::string_view thread_pool_ratio_key_{"--thread-pool-ratio"}; public: void execute(FunctionPtr function, DataStream &unused_os) final; diff --git a/runtime/interface.cpp b/runtime/interface.cpp index 5315d38ea2..ad4ddfa288 100644 --- a/runtime/interface.cpp +++ b/runtime/interface.cpp @@ -2369,7 +2369,7 @@ static void init_runtime_libs() { init_interface_lib(); -// vk::singleton::get().init(); + vk::singleton::get().init(); } static void free_shutdown_functions() { @@ -2395,7 +2395,7 @@ static void free_interface_lib() { static void free_runtime_libs() { php_assert (dl::in_critical_section == 0); -// vk::singleton::get().stop(); + vk::singleton::get().stop(); forcibly_stop_and_flush_profiler(); free_bcmath_lib(); diff --git a/runtime/thread-pool.cpp b/runtime/thread-pool.cpp index 2c8ca5bfa9..554006b334 100644 --- a/runtime/thread-pool.cpp +++ b/runtime/thread-pool.cpp @@ -7,8 +7,7 @@ void ThreadPool::init() noexcept { int thread_pool_size = static_cast(std::thread::hardware_concurrency() * thread_pool_ratio); if (thread_pool_size > 0 && !is_thread_pool_available()) { - new (&thread_pool_storage) BS::thread_pool(thread_pool_size); - thread_pool_ptr = reinterpret_cast(&thread_pool_storage); + thread_pool_ptr = new BS::thread_pool(thread_pool_size); } } diff --git a/runtime/thread-pool.h b/runtime/thread-pool.h index 71f16ae1f5..11f2a3b74c 100644 --- a/runtime/thread-pool.h +++ b/runtime/thread-pool.h @@ -26,7 +26,9 @@ class ThreadPool : vk::not_copyable { /** Here we need to stop all running threads to ensure independence of requests * todo find a way to kill threads. It can be done by pthread_kill * */ - thread_pool_ptr->wait_for_tasks(); + if (thread_pool_ptr != nullptr) { + thread_pool_ptr->wait_for_tasks(); + } } @@ -36,8 +38,6 @@ class ThreadPool : vk::not_copyable { friend class vk::singleton; BS::thread_pool * thread_pool_ptr{nullptr}; - - std::aligned_storage_t thread_pool_storage; }; extern double thread_pool_ratio;