=?UTF-8?Q?J=C3=B6rg=20H=C3=B6hle=20?=: ntdll: Stabilize CreateTimerQueueTimer callbacks over time.
Alexandre Julliard
julliard at winehq.org
Tue Feb 19 13:33:04 CST 2013
Module: wine
Branch: master
Commit: 2f0b93ca134ca68857bef36a3f2a5cf8f620740a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2f0b93ca134ca68857bef36a3f2a5cf8f620740a
Author: Jörg Höhle <hoehle at users.sourceforge.net>
Date: Sun Mar 4 07:30:18 2012 +0100
ntdll: Stabilize CreateTimerQueueTimer callbacks over time.
---
dlls/ntdll/threadpool.c | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/dlls/ntdll/threadpool.c b/dlls/ntdll/threadpool.c
index f246cfb..e33a025 100644
--- a/dlls/ntdll/threadpool.c
+++ b/dlls/ntdll/threadpool.c
@@ -651,13 +651,21 @@ static void queue_timer_expire(struct timer_queue *q)
RtlEnterCriticalSection(&q->cs);
if (list_head(&q->timers))
{
+ ULONGLONG now, next;
t = LIST_ENTRY(list_head(&q->timers), struct queue_timer, entry);
- if (!t->destroy && t->expire <= queue_current_time())
+ if (!t->destroy && t->expire <= ((now = queue_current_time())))
{
++t->runcount;
- queue_move_timer(
- t, t->period ? queue_current_time() + t->period : EXPIRE_NEVER,
- FALSE);
+ if (t->period)
+ {
+ next = t->expire + t->period;
+ /* avoid trigger cascade if overloaded / hibernated */
+ if (next < now)
+ next = now + t->period;
+ }
+ else
+ next = EXPIRE_NEVER;
+ queue_move_timer(t, next, FALSE);
}
else
t = NULL;
More information about the wine-cvs
mailing list