mirror of
https://github.com/reactos/reactos.git
synced 2024-08-04 02:20:54 +00:00
- Remove stupid and greatly broken "let's wait in a loop, while querying current time" by calls to KeDelayExecutionThread().
svn path=/trunk/; revision=30620
This commit is contained in:
parent
ac0ce5049d
commit
776a248981
|
@ -1014,80 +1014,24 @@ LBL_OUT:
|
||||||
VOID
|
VOID
|
||||||
usb_wait_ms_dpc(ULONG ms)
|
usb_wait_ms_dpc(ULONG ms)
|
||||||
{
|
{
|
||||||
LARGE_INTEGER start;
|
LARGE_INTEGER Interval;
|
||||||
LARGE_INTEGER ticker;
|
if (ms <= 0)
|
||||||
LARGE_INTEGER freq;
|
return;
|
||||||
ULONG interval;
|
|
||||||
ULONG expire_count;
|
|
||||||
|
|
||||||
KeQueryPerformanceCounter(&freq);
|
Interval.QuadPart = -ms * 10000;
|
||||||
|
KeDelayExecutionThread(KernelMode, FALSE, &Interval);
|
||||||
expire_count = 2000000;
|
|
||||||
if (cpu_clock_freq)
|
|
||||||
expire_count = (cpu_clock_freq / 1000) * ms;
|
|
||||||
|
|
||||||
if (usb_query_clicks(&start) == FALSE)
|
|
||||||
{
|
|
||||||
ticker.QuadPart = 0;
|
|
||||||
while (TRUE)
|
|
||||||
{
|
|
||||||
KeQuerySystemTime(&ticker);
|
|
||||||
interval = ticker.LowPart - start.LowPart;
|
|
||||||
if (interval >= ms * 10000)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ticker.QuadPart = 0;
|
|
||||||
while (TRUE)
|
|
||||||
{
|
|
||||||
usb_query_clicks(&ticker);
|
|
||||||
interval = ticker.LowPart - start.LowPart;
|
|
||||||
if (interval >= expire_count)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
usb_wait_us_dpc(ULONG us)
|
usb_wait_us_dpc(ULONG us)
|
||||||
{
|
{
|
||||||
LARGE_INTEGER start;
|
LARGE_INTEGER Interval;
|
||||||
LARGE_INTEGER ticker;
|
if (us <= 0)
|
||||||
LARGE_INTEGER freq;
|
return;
|
||||||
ULONG interval;
|
|
||||||
ULONG expire_count;
|
|
||||||
|
|
||||||
KeQueryPerformanceCounter(&freq);
|
Interval.QuadPart = -us;
|
||||||
|
KeDelayExecutionThread(KernelMode, FALSE, &Interval);
|
||||||
expire_count = 2000000;
|
|
||||||
if (cpu_clock_freq)
|
|
||||||
expire_count = (cpu_clock_freq / 1000000) * us;
|
|
||||||
|
|
||||||
if (usb_query_clicks(&start) == FALSE)
|
|
||||||
{
|
|
||||||
ticker.QuadPart = 0;
|
|
||||||
while (TRUE)
|
|
||||||
{
|
|
||||||
KeQuerySystemTime(&ticker);
|
|
||||||
interval = ticker.LowPart - start.LowPart;
|
|
||||||
if (interval >= us * 10)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ticker.QuadPart = 0;
|
|
||||||
while (TRUE)
|
|
||||||
{
|
|
||||||
usb_query_clicks(&ticker);
|
|
||||||
interval = ticker.LowPart - start.LowPart;
|
|
||||||
if (interval >= expire_count)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
|
Loading…
Reference in a new issue