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

Notify module to cleanup before FreeLibrary of Module DLL

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

在 Windows 我正在寻找一种方法在卸载 DLL 之前在模块 DLL 中进行一些清理,因为 possibilities of thread deadlock inside DLLMain() DLLMain 处理进程分离以及线程分离,因此您不能在进程分离时等待线程。

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