Further optimisation to Windows timers. Some more to come later

git-svn-id: svn://10.0.0.236/trunk@58468 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
michael.lowe%bigfoot.com
2000-01-24 13:35:21 +00:00
parent a0876134ef
commit eaa317cc7b

View File

@@ -71,21 +71,24 @@ void CALLBACK FireTimeout(HWND aWindow,
nsCOMPtr<nsITimerQueue> queue = do_QueryInterface(manager, &rv);
if (NS_FAILED(rv)) return;
if (timer->GetPriority() >= NS_PRIORITY_IMMEDIATE) {
MSG wmsg;
if (!::PeekMessage(&wmsg, NULL, 0, 0, PM_NOREMOVE) ||
timer->GetPriority() >= NS_PRIORITY_IMMEDIATE) {
// fire timer immediatly
timer->Fire();
// while event queue is empty, fire off waiting timers
while (queue->HasReadyTimers(NS_PRIORITY_LOWEST) &&
!::PeekMessage(&wmsg, NULL, 0, 0, PM_NOREMOVE)) {
queue->FireNextReadyTimer(NS_PRIORITY_LOWEST);
}
} else {
// defer timer firing
queue->AddReadyQueue(timer);
}
// while event queue is empty, fire off waiting timers
MSG wmsg;
while (queue->HasReadyTimers(NS_PRIORITY_LOWEST) &&
!::PeekMessage(&wmsg, NULL, 0, 0, PM_NOREMOVE)) {
queue->FireNextReadyTimer(NS_PRIORITY_LOWEST);
}
}