jeudi 25 février 2016

find a element in a vector from one of its arguments

How would i find a element in a vector from one of its arguments set with emplace_back Trying to detach thread then delete it from vector.

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);

Aucun commentaire:

Enregistrer un commentaire