Commit in reactos/ntoskrnl on MAIN
include/internal/ps.h+2-21.75 -> 1.76
ps/cid.c+5-241.2 -> 1.3
+7-26
2 modified files
- Used a fast mutex for the client id structure.

reactos/ntoskrnl/include/internal
ps.h 1.75 -> 1.76
diff -u -r1.75 -r1.76
--- ps.h	20 Nov 2004 16:46:05 -0000	1.75
+++ ps.h	27 Nov 2004 19:41:55 -0000	1.76
@@ -16,7 +16,7 @@
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-/* $Id: ps.h,v 1.75 2004/11/20 16:46:05 weiden Exp $
+/* $Id: ps.h,v 1.76 2004/11/27 19:41:55 hbirr Exp $
  *
  * FILE:            ntoskrnl/ke/kthread.c
  * PURPOSE:         Process manager definitions
@@ -653,7 +653,7 @@
   LONG ref;
   HANDLE Handle;
   LIST_ENTRY Entry;
-  LONG Lock;
+  FAST_MUTEX Lock;
   union
   {
     struct _EPROCESS *Process;

reactos/ntoskrnl/ps
cid.c 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- cid.c	12 Oct 2004 20:00:40 -0000	1.2
+++ cid.c	27 Nov 2004 19:41:55 -0000	1.3
@@ -1,4 +1,4 @@
-/* $Id: cid.c,v 1.2 2004/10/12 20:00:40 navaraf Exp $
+/* $Id: cid.c,v 1.3 2004/11/27 19:41:55 hbirr Exp $
  *
  * COPYRIGHT:         See COPYING in the top level directory
  * PROJECT:           ReactOS kernel
@@ -66,7 +66,7 @@
   if(cido != NULL)
   {
     cido->ref = 1;
-    cido->Lock = 0;
+    ExInitializeFastMutex(&cido->Lock);
     cido->Obj.Object = Object;
 
     KeAcquireSpinLock(&CidLock, &oldIrql);
@@ -147,35 +147,16 @@
   
   if(Found != NULL)
   {
-    ULONG Attempt = 0;
-    for (;;)
-    {
-      if(InterlockedCompareExchange(&Found->Lock, 1, 0) == 0)
-      {
-        /* got the lock, bail */
-        break;
-      }
-
-      if(Attempt++ >= 1)
-      {
-        /* wait a little longer */
-        KeDelayExecutionThread(KernelMode, FALSE, &LongDelay);
-      }
-      else
-      {
-        /* try again, just wait shortly */
-        KeDelayExecutionThread(KernelMode, FALSE, &ShortDelay);
-      }
-    }
+    ExAcquireFastMutex(&Found->Lock);
   }
-  
+
   return Found;
 }
 
 VOID
 PsUnlockCidObject(PCID_OBJECT CidObject)
 {
-  InterlockedExchange(&CidObject->Lock, 0);
+  ExReleaseFastMutex(&CidObject->Lock);
   PspDereferenceCidObject(CidObject);
 }
 
CVSspam 0.2.8