gpt4 book ai didi

windows - 在 DllMain 中,是否可以在没有 DLL_THREAD_ATTACH 的情况下发生 DLL_THREAD_DETACH?

转载 作者:可可西里 更新时间:2023-11-01 11:54:22 41 4
gpt4 key购买 nike

如果在我的 DLL 加载之前线程已经创建。然后,线程在我的 DLL 卸载之前退出。问题是:

我的 DllMain 将收到 DLL_THREAD_DETACH 通知,还是没有关于退出线程的通知?

感谢提前。

最佳答案

您会收到通知。它明确记录在 MSDN article 中对于 DllMain:

There are cases in which the entry-point function is called for a terminating thread even if the entry-point function was never called with DLL_THREAD_ATTACH for the thread:

  • The thread was the initial thread in the process, so the system called the entry-point function with the DLL_PROCESS_ATTACH value.
  • The thread was already running when a call to the LoadLibrary function was made, so the system never called the entry-point function for it.

关于windows - 在 DllMain 中,是否可以在没有 DLL_THREAD_ATTACH 的情况下发生 DLL_THREAD_DETACH?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21026984/

41 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com