我正在构建一个基于wec7的应用程序。我有以下主题:
bool ChannelDataQueue::b_ChannelDataQueue_StartThread()
{
m_hThread = CreateThread(NULL, 0, ChannelDataQueue::u32_ChannelDataQueue_ReadChannelData, (LPVOID)this, CREATE_SUSPENDED, NULL);
CeSetThreadPriority(m_hThread,CE_THREAD_PRIO_256_HIGHEST);
//SetThreadPriority(m_hThread,249);//248
ResumeThread(m_hThread);
return true;
}
我正在使用VS2008中的远程工具来监视进程和线程,但线程只显示它们所处的进程和TID / PID。我不知道如何根据其ID确定我正在监视哪个线程。
答案 0 :(得分:0)
CreateThread调用的最后一个参数是指向将接收线程ID的DWORD的指针。
示例:
bool ChannelDataQueue::b_ChannelDataQueue_StartThread()
{
DWORD threadID;
m_hThread = CreateThread(NULL, 0, ChannelDataQueue::u32_ChannelDataQueue_ReadChannelData, (LPVOID)this, CREATE_SUSPENDED, &threadID);
// At this point, inspect the threadID in the debugger,
// print it to the console, write it to a file, etc...
CeSetThreadPriority(m_hThread,CE_THREAD_PRIO_256_HIGHEST);
//SetThreadPriority(m_hThread,249);//248
ResumeThread(m_hThread);
return true;
}