Further optimisation to Windows timers. Some more to come later

This commit is contained in:
michael.lowe%bigfoot.com 2000-01-24 13:35:21 +00:00
Родитель 0ff017366d
Коммит e8323398fa
1 изменённых файлов: 12 добавлений и 9 удалений

Просмотреть файл

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