Support Priority Boosting during Wait Satisfaction and Thread Abortion, and use it where necessary. Should provide a bit more responsiveness.
Modified: trunk/reactos/ntoskrnl/include/internal/ke.h
Modified: trunk/reactos/ntoskrnl/ke/apc.c
Modified: trunk/reactos/ntoskrnl/ke/event.c
Modified: trunk/reactos/ntoskrnl/ke/kthread.c
Modified: trunk/reactos/ntoskrnl/ke/queue.c
Modified: trunk/reactos/ntoskrnl/ke/sem.c
Modified: trunk/reactos/ntoskrnl/ke/timer.c
Modified: trunk/reactos/ntoskrnl/ke/wait.c
Modified: trunk/reactos/ntoskrnl/ps/kill.c

Modified: trunk/reactos/ntoskrnl/include/internal/ke.h
--- trunk/reactos/ntoskrnl/include/internal/ke.h	2005-03-14 05:54:58 UTC (rev 14048)
+++ trunk/reactos/ntoskrnl/include/internal/ke.h	2005-03-14 06:44:31 UTC (rev 14049)
@@ -160,7 +160,11 @@
 VOID KeDumpStackFrames(PULONG Frame);
 BOOLEAN KiTestAlert(VOID);
 
-VOID FASTCALL KiAbortWaitThread(struct _KTHREAD* Thread, NTSTATUS WaitStatus);
+VOID
+FASTCALL 
+KiAbortWaitThread(PKTHREAD Thread, 
+                  NTSTATUS WaitStatus,
+                  KPRIORITY Increment);
  
 BOOLEAN STDCALL KiInsertTimer(PKTIMER Timer, LARGE_INTEGER DueTime);
 

Modified: trunk/reactos/ntoskrnl/ke/apc.c
--- trunk/reactos/ntoskrnl/ke/apc.c	2005-03-14 05:54:58 UTC (rev 14048)
+++ trunk/reactos/ntoskrnl/ke/apc.c	2005-03-14 06:44:31 UTC (rev 14049)
@@ -276,7 +276,7 @@
                  (Apc->NormalRoutine == NULL)) {
           
             DPRINT("Waking up Thread for Kernel-Mode APC Delivery \n");
-            KiAbortWaitThread(Thread, STATUS_KERNEL_APC);
+            KiAbortWaitThread(Thread, STATUS_KERNEL_APC, PriorityBoost);
         }
         
    } else if ((Thread->State == THREAD_STATE_BLOCKED) && 
@@ -285,7 +285,7 @@
        
         DPRINT("Waking up Thread for User-Mode APC Delivery \n");
         Thread->ApcState.UserApcPending = TRUE;
-        KiAbortWaitThread(Thread, STATUS_USER_APC);
+        KiAbortWaitThread(Thread, STATUS_USER_APC, PriorityBoost);
     }
 
     /* Return Sucess if we are here */

Modified: trunk/reactos/ntoskrnl/ke/event.c
--- trunk/reactos/ntoskrnl/ke/event.c	2005-03-14 05:54:58 UTC (rev 14048)
+++ trunk/reactos/ntoskrnl/ke/event.c	2005-03-14 06:44:31 UTC (rev 14049)
@@ -1,11 +1,12 @@
-/* $Id$
+/*
  *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ke/event.c
  * PURPOSE:         Implements events
  * 
- * PROGRAMMERS:     David Welch (welch@mcmail.com)
+ * PROGRAMMERS:     Alex Ionescu (alex@relsoft.net)
+ *                  David Welch (welch@mcmail.com)
  */
 
 /* INCLUDES *****************************************************************/
@@ -203,7 +204,7 @@
         
             /* We can satisfy wait simply by waking the thread, since our signal state is 0 now */        
             DPRINT("WaitAny or Sync Event, just unwait the thread\n");
-            KiAbortWaitThread(WaitBlock->Thread, WaitBlock->WaitKey);
+            KiAbortWaitThread(WaitBlock->Thread, WaitBlock->WaitKey, Increment);
         }
     }
     
@@ -259,7 +260,7 @@
 
         /* Reset the Quantum and Unwait the Thread */
         WaitingThread->Quantum = WaitingThread->ApcState.Process->ThreadQuantum;
-        KiAbortWaitThread(WaitingThread, STATUS_SUCCESS);
+        KiAbortWaitThread(WaitingThread, STATUS_SUCCESS, EVENT_INCREMENT);
     }
    
     /* Release the Dispatcher Database Lock */

Modified: trunk/reactos/ntoskrnl/ke/kthread.c
--- trunk/reactos/ntoskrnl/ke/kthread.c	2005-03-14 05:54:58 UTC (rev 14048)
+++ trunk/reactos/ntoskrnl/ke/kthread.c	2005-03-14 06:44:31 UTC (rev 14049)
@@ -4,7 +4,7 @@
  * FILE:            ntoskrnl/ke/kthread.c
  * PURPOSE:         Microkernel thread support
  * 
- * PROGRAMMERS:     Alex Ionescu (alex@relsoft.net) - Commented, reorganized some stuff, fixed/implemented some functions.
+ * PROGRAMMERS:     Alex Ionescu (alex@relsoft.net)
  *                  David Welch (welch@cwcom.net)
  */
 
@@ -14,6 +14,7 @@
 #define NDEBUG
 #include <internal/debug.h>
 
+#define THREAD_ALERT_INCREMENT 2
 /* FUNCTIONS *****************************************************************/
 
 ULONG
@@ -36,7 +37,7 @@
         if (Thread->State == THREAD_STATE_BLOCKED &&  Thread->Alertable) {
             
             DPRINT("Aborting Wait\n");
-            KiAbortWaitThread(Thread, STATUS_ALERTED);
+            KiAbortWaitThread(Thread, STATUS_ALERTED, THREAD_ALERT_INCREMENT);
        
         } else {
            
@@ -89,7 +90,7 @@
             Thread->Alertable) {
             
             DPRINT("Aborting Wait\n");
-            KiAbortWaitThread(Thread, STATUS_ALERTED);
+            KiAbortWaitThread(Thread, STATUS_ALERTED, THREAD_ALERT_INCREMENT);
        
         } else {
            

Modified: trunk/reactos/ntoskrnl/ke/queue.c
--- trunk/reactos/ntoskrnl/ke/queue.c	2005-03-14 05:54:58 UTC (rev 14048)
+++ trunk/reactos/ntoskrnl/ke/queue.c	2005-03-14 06:44:31 UTC (rev 14049)
@@ -1,11 +1,12 @@
-/* $Id$
- *
+/*
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS kernel
  * FILE:            ntoskrnl/ke/queue.c
  * PURPOSE:         Implements kernel queues
  * 
- * PROGRAMMERS:     Eric Kohl (ekohl@rz-online.de)
+ * PROGRAMMERS:     Alex Ionescu (alex@relsoft.net)
+ *                  Gunnar Dalsnes
+ *                  Eric Kohl (ekohl@rz-online.de)
  */
 
 /* INCLUDES *****************************************************************/
@@ -409,7 +410,7 @@
             /* Unwait the Thread */
             DPRINT("Unwaiting Thread\n");
             WaitBlock = CONTAINING_RECORD(WaitEntry, KWAIT_BLOCK, WaitListEntry);
-            KiAbortWaitThread(WaitBlock->Thread, (NTSTATUS)QueueEntry);
+            KiAbortWaitThread(WaitBlock->Thread, (NTSTATUS)QueueEntry, IO_NO_INCREMENT);
         }
     }    
 }

Modified: trunk/reactos/ntoskrnl/ke/sem.c
--- trunk/reactos/ntoskrnl/ke/sem.c	2005-03-14 05:54:58 UTC (rev 14048)
+++ trunk/reactos/ntoskrnl/ke/sem.c	2005-03-14 06:44:31 UTC (rev 14049)
@@ -111,7 +111,7 @@
     if (InitialState == 0 && !IsListEmpty(&Semaphore->Header.WaitListHead)) {
         
         /* Wake the Semaphore */
-        KiWaitTest(&Semaphore->Header, SEMAPHORE_INCREMENT);
+        KiWaitTest(&Semaphore->Header, Increment);
     }
 
     /* If the Wait is true, then return with a Wait and don't unlock the Dispatcher Database */

Modified: trunk/reactos/ntoskrnl/ke/timer.c
--- trunk/reactos/ntoskrnl/ke/timer.c	2005-03-14 05:54:58 UTC (rev 14048)
+++ trunk/reactos/ntoskrnl/ke/timer.c	2005-03-14 06:44:31 UTC (rev 14049)
@@ -291,7 +291,7 @@
     /* Set it as Signaled */
     DPRINT("Setting Timer as Signaled\n");
     Timer->Header.SignalState = TRUE;
-    KiWaitTest(&Timer->Header, 0);   
+    KiWaitTest(&Timer->Header, IO_NO_INCREMENT);   
 
     /* If the Timer is periodic, reinsert the timer with the new due time */
     if (Timer->Period) {

Modified: trunk/reactos/ntoskrnl/ke/wait.c
--- trunk/reactos/ntoskrnl/ke/wait.c	2005-03-14 05:54:58 UTC (rev 14048)
+++ trunk/reactos/ntoskrnl/ke/wait.c	2005-03-14 06:44:31 UTC (rev 14049)
@@ -702,7 +702,7 @@
         
         /* All waits satisfied, unwait the thread */
         DPRINT("Unwaiting the Thread\n");
-        KiAbortWaitThread(CurrentWaitBlock->Thread, CurrentWaitBlock->WaitKey);
+        KiAbortWaitThread(CurrentWaitBlock->Thread, CurrentWaitBlock->WaitKey, Increment);
 
 SkipUnwait:
         /* Next entry */
@@ -716,7 +716,8 @@
 VOID
 FASTCALL 
 KiAbortWaitThread(PKTHREAD Thread, 
-                  NTSTATUS WaitStatus)
+                  NTSTATUS WaitStatus,
+                  KPRIORITY Increment)
 {
     PKWAIT_BLOCK WaitBlock;
 

Modified: trunk/reactos/ntoskrnl/ps/kill.c
--- trunk/reactos/ntoskrnl/ps/kill.c	2005-03-14 05:54:58 UTC (rev 14048)
+++ trunk/reactos/ntoskrnl/ps/kill.c	2005-03-14 06:44:31 UTC (rev 14049)
@@ -297,7 +297,7 @@
   if (THREAD_STATE_BLOCKED == Thread->Tcb.State && UserMode == Thread->Tcb.WaitMode)
     {
       DPRINT("Unblocking thread\n");
-      KiAbortWaitThread((PKTHREAD)Thread, STATUS_THREAD_IS_TERMINATING);
+      KiAbortWaitThread((PKTHREAD)Thread, STATUS_THREAD_IS_TERMINATING, IO_NO_INCREMENT);
     }
   KeReleaseDispatcherDatabaseLock(OldIrql); 
 }