本文介绍了在DllMain中创建一个线程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎当在$ code> DLL_PROCESS_ATTACH 之后从DllMain创建一个线程时,直到所有dll都被加载,它才会开始。由于我需要确保线程在继续之前运行,所以我得到一个僵局。有没有办法强制线程启动?

It seems that when a thread is created from within DllMain upon DLL_PROCESS_ATTACH it won't begin until all dll's have been loaded. Since I need to make sure the thread runs before I continue, I get a deadlock. Is there any way to force the thread to start?

推荐答案

你不应该做任何API调用,特别是对于从DLLMain创建线程或窗口。陈雷蒙多次写了这篇文章;这里是。

You shouldn't be doing any API calls, especially for things like creating threads or windows, from DLLMain. Raymond Chen has written about this many times; here's one that's particularly relevant.

这篇关于在DllMain中创建一个线程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 09:15