使用WinApi和OpenGL的线程数量不足. [英] Extra, unaccounted for threads using WinApi with OpenGL.
本文介绍了使用WinApi和OpenGL的线程数量不足.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的程序出现问题,使用Winapi的代码块会创建2个额外的线程.在所使用的函数的文档中,我什么都没有看到,这表明将创建线程.但是,如果我不运行此块,则我的程序只有1个线程,如果有,则有3个线程.这是代码块:
I have a problem in my program where 2 extra threads get created from a block of code that uses the winapi. I saw nothing in the documentation of the functions used that indicates that the threads would be created. But if I don''t run this block my program has 1 thread and if I do then it has 3. This is the code block:
if (!(hdc = GetDC(hwd)) ||
!(PixelFormat = ChoosePixelFormat(hdc, &pfd)) ||
!(SetPixelFormat(hdc,PixelFormat, &pfd)) ||
!(hrc = wglCreateContext(hdc)))
{
DestructWindow();
return false;
}
Is there any way to get rid of those 2 extra threads or are they supposed to be there?
推荐答案
James,
Microsoft GDI +库gdiplus.dll将在您的进程中产生工作线程.我认为没有任何记录的方法可以控制此情况.您可能可以通过下载 Process Explorer [ Windows调试工具 [
James,
The Microsoft GDI+ library gdiplus.dll will spawn worker threads within your process. I don''t think there is any documented way to control this. You can probably verify this by downloading Process Explorer[^] and right-clicking your process and selecting the ''Threads'' tab. If you have Debugging Tools for Windows[^] installed and your symbols properly setup you will even be able to inspect the call stack.
Best Wishes,
-David Delaune
这篇关于使用WinApi和OpenGL的线程数量不足.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文