0

我正在构建一个基于 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 确定我正在监视的线程。

4

1 回答 1

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;
}
于 2015-08-14T16:58:30.190 回答