在 DllMain 中创建线程? [英] Creating a thread in DllMain?

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

问题描述

似乎在 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?

推荐答案

您不应该从 DLLMain 进行任何 API 调用,尤其是对于创建线程或窗口之类的事情.Raymond Chen 已经写过很多次了;这是 一个特别相关.

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 中创建线程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆