我将如何找到一个向量元素从它的参数与emplace_back 试图分离线程然后从向量中删除它设置一个一个找到的矢量的元素。从它的参数
std::vector<std::thread> vTimerThreads;
void SetTimer(UINT ID, DWORD dwMilliseconds)
{
// timerThreadProc is my thread that handles my timers
vTimerThreads.emplace_back(timerThreadProc, ID, dwMilliseconds);
}
void DeleteTimer(UINT ID)
{
//Find thread by ID?
// thread.detach();
// then delete
}
SetTimer(TIMER1, 5000);
您尚未在任何地方存储“ID”,至少可以从矢量访问的任何位置。 – chris