What is the difference between these two codes? What is the best / fastest way. Trying to make my own WM_TIMER thread.
1st: timerThreadProc
with get_id()
DWORD WINAPI timerThreadProc(DWORD dwMilliseconds)
{
while (!bExit)
{
if (std::this_thread::get_id() == hTimer1Thread.get_id())
{
// do what ever
Beep(10000, 100);
}
if (std::this_thread::get_id() == hTimer2Thread.get_id())
{
// do what ever
Beep(1000, 100);
}
Sleep(dwMilliseconds);
}
return 1;
}
2nd: timerThreadProc
without get_id()
#define TIMER1 1
#define TIMER2 2
DWORD WINAPI timerThreadProc(UINT ID, DWORD dwMilliseconds)
{
while (!bExit)
{
if (ID == TIMER1)
{
// do what ever
Beep(10000, 100);
}
if (ID == TIMER2)
{
// do what ever
Beep(1000, 100);
}
Sleep(dwMilliseconds);
}
return 1;
}
Aucun commentaire:
Enregistrer un commentaire