[PATCH 1/3] ntdll: Queue timers on timer thread as apc

Maarten Lankhorst m.b.lankhorst at gmail.com
Tue Apr 6 16:49:09 CDT 2010


---
 dlls/ntdll/threadpool.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/dlls/ntdll/threadpool.c b/dlls/ntdll/threadpool.c
index 44afb01..461777f 100644
--- a/dlls/ntdll/threadpool.c
+++ b/dlls/ntdll/threadpool.c
@@ -601,6 +601,12 @@ static DWORD WINAPI timer_callback_wrapper(LPVOID p)
     return 0;
 }
 
+static void CALLBACK timer_callback_apc(ULONG_PTR p, ULONG_PTR arg2, ULONG_PTR arg3) {
+    struct queue_timer *t = (struct queue_timer *)p;
+    t->callback(t->param, TRUE);
+    timer_cleanup_callback(t);
+}
+
 static inline ULONGLONG queue_current_time(void)
 {
     LARGE_INTEGER now;
@@ -665,7 +671,7 @@ static void queue_timer_expire(struct timer_queue *q)
     if (t)
     {
         if (t->flags & WT_EXECUTEINTIMERTHREAD)
-            timer_callback_wrapper(t);
+            NtQueueApcThread(q->thread, timer_callback_apc, (ULONG_PTR)t, 0, 0);
         else
         {
             ULONG flags
@@ -714,7 +720,7 @@ static void WINAPI timer_queue_thread_proc(LPVOID p)
         BOOL done = FALSE;
 
         status = NtWaitForSingleObject(
-            q->event, FALSE, get_nt_timeout(&timeout, timeout_ms));
+            q->event, TRUE, get_nt_timeout(&timeout, timeout_ms));
 
         if (status == STATUS_WAIT_0)
         {
-- 
1.7.0


--------------090501000602080501010902--



More information about the wine-patches mailing list