My PC has a clock resolution of 10ms. (from a benchmark utility program).
I need to make avaliable some data for a period of 50ms, so was thinking of using CreatWaitableTimer;
i.e. Wait (50 /* 50ms */);
bool Wait(int period)
{
HANDLE hTimer = NULL;
LARGE_INTEGER timeDue;
hTimer = CreateWaitableTimer(NULL, TRUE, "WAIT50MS"
SetWaitable(hTimer, &timeDue, 0, NULL, NULL, 0);
WaitForSingleObject(hTimer, INIFITE);
return true;
}
I understand Sleep(50); would be OK for most of the time but could fail when Windows schedules some other activity.
How god would the alternative above be?
I did some timing tests, but am I missing anything?
Sweep.
I need to make avaliable some data for a period of 50ms, so was thinking of using CreatWaitableTimer;
i.e. Wait (50 /* 50ms */);
bool Wait(int period)
{
HANDLE hTimer = NULL;
LARGE_INTEGER timeDue;
hTimer = CreateWaitableTimer(NULL, TRUE, "WAIT50MS"
SetWaitable(hTimer, &timeDue, 0, NULL, NULL, 0);
WaitForSingleObject(hTimer, INIFITE);
return true;
}
I understand Sleep(50); would be OK for most of the time but could fail when Windows schedules some other activity.
How god would the alternative above be?
I did some timing tests, but am I missing anything?
Sweep.