如果在加载我的 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/