Fix bug in gate code
Modified: trunk/reactos/ntoskrnl/ke/gate.c

Modified: trunk/reactos/ntoskrnl/ke/gate.c
--- trunk/reactos/ntoskrnl/ke/gate.c	2005-06-17 00:13:10 UTC (rev 15941)
+++ trunk/reactos/ntoskrnl/ke/gate.c	2005-06-17 00:13:44 UTC (rev 15942)
@@ -44,8 +44,8 @@
     do
     {
         /* Lock the APC Queue */
-        KeAcquireSpinLock(&CurrentThread->ApcQueueLock, &OldIrql);
-
+        OldIrql = KeAcquireDispatcherDatabaseLock();
+        
         /* Check if it's already signaled */
         if (!Gate->Header.SignalState)
         {
@@ -53,7 +53,7 @@
             Gate->Header.SignalState = 0;
 
             /* Unlock the Queue and return */
-            KeReleaseSpinLock(&CurrentThread->ApcQueueLock, OldIrql);
+            KeReleaseDispatcherDatabaseLock(OldIrql);
             return;
         }
 
@@ -78,9 +78,6 @@
             KiWakeQueue(CurrentThread->Queue);
         }
 
-        /* Unlock the Queue*/
-        KeReleaseSpinLock(&CurrentThread->ApcQueueLock, OldIrql);
-
         /* Block the Thread */
         DPRINT("Blocking the Thread: %x\n", CurrentThread);
         KiBlockThread(&Status,