for(int i = 0; i < m_nThreads; i++)
{
while(true)
{
DWORD dwExitcode = 0;
GetExitCodeThread(m_phWorkerThreads[i], &dwExitcode);
if(dwExitcode != STILL_ACTIVE)
break;
Sleep(1);
}
}其中m_nThreads的数量是2;
m_phWorkerThreads是HANDLE数组,保存CreateThread时的HANDLE值。搞不懂为什么线程已经return 0了,但GetExitCodeThread的ExitCode一直是STILL_ACTIVE。
{
while(true)
{
DWORD dwExitcode = 0;
GetExitCodeThread(m_phWorkerThreads[i], &dwExitcode);
if(dwExitcode != STILL_ACTIVE)
break;
Sleep(1);
}
}其中m_nThreads的数量是2;
m_phWorkerThreads是HANDLE数组,保存CreateThread时的HANDLE值。搞不懂为什么线程已经return 0了,但GetExitCodeThread的ExitCode一直是STILL_ACTIVE。
看看你的代码 这个m_phWorkerThreads[0]线程一直在,那你代码永远出不了while循环.写法问题