在模块 DLL 的 FreeLibrary 之前通知模块进行清理

问题描述

Apache Web 服务器是否以任何方式通知模块即将卸载模块?

在 Windows 上,我正在寻找一种在卸载 DLL 之前在模块 DLL 中进行一些清理的方法,因为 possibilities of thread deadlock inside DLLMain() const countries= [ {label: "Germany",value: "DE"},{label: "France",value: "FR"},{label: "Spain",value: "ES"},]; const result = countries.sort((a,b) => a.value === "FR" ? -1 : b.value === "FR" ? 1 : 0); console.log(result); 处理进程分离和线程分离,因此您进程分离时不能等待线程。

解决方法

我发现了 Apache 的 apr_pool_cleanup 和配套的 apr_pool_cleanup_register 过程,它在清理过程中注册了一个钩子。这将允许您在卸载 DLL 之前进行一些适当的清理