Fix really really big Mutex/APC bug. Killing GUI Threads from taskmanager should now work flawlessly, and gui apps should work better; the bug had probably tiny important impact in them
Modified: trunk/reactos/ntoskrnl/ke/mutex.c

Modified: trunk/reactos/ntoskrnl/ke/mutex.c
--- trunk/reactos/ntoskrnl/ke/mutex.c	2005-03-22 03:05:46 UTC (rev 14263)
+++ trunk/reactos/ntoskrnl/ke/mutex.c	2005-03-22 03:06:03 UTC (rev 14264)
@@ -162,10 +162,28 @@
     /* Check if the signal state is only single */
     if (Mutant->Header.SignalState == 1) {
         
+        /* Check if it's below 0 now */
         if (PreviousState <= 0) {
         
+            /* Remove the mutant from the list */
             DPRINT("Removing Mutant\n");
             RemoveEntryList(&Mutant->MutantListEntry);
+            
+            /* Reenable APCs */
+            DPRINT("Re-enabling APCs\n");
+            CurrentThread->KernelApcDisable += Mutant->ApcDisable;
+            
+            /* Force an Interrupt if Apcs are pending */
+            if (!IsListEmpty(&CurrentThread->ApcState.ApcListHead[KernelMode])) {
+            
+                /* Make sure they aren't disabled though */
+                if (!CurrentThread->KernelApcDisable) {
+                
+                    /* Request the Interrupt */
+                    DPRINT("Requesting APC Interupt\n");
+                    HalRequestSoftwareInterrupt(APC_LEVEL);
+                }
+            }
         }
         
         /* Remove the Owning Thread and wake it */