mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 17:33:18 +00:00
- Used a fast mutex for the client id structure.
svn path=/trunk/; revision=11846
This commit is contained in:
parent
ae233008f1
commit
7eacfe074f
2 changed files with 7 additions and 26 deletions
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* 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
|
* FILE: ntoskrnl/ke/kthread.c
|
||||||
* PURPOSE: Process manager definitions
|
* PURPOSE: Process manager definitions
|
||||||
|
@ -653,7 +653,7 @@ typedef struct _CID_OBJECT
|
||||||
LONG ref;
|
LONG ref;
|
||||||
HANDLE Handle;
|
HANDLE Handle;
|
||||||
LIST_ENTRY Entry;
|
LIST_ENTRY Entry;
|
||||||
LONG Lock;
|
FAST_MUTEX Lock;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct _EPROCESS *Process;
|
struct _EPROCESS *Process;
|
||||||
|
|
|
@ -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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -66,7 +66,7 @@ PsCreateCidHandle(PVOID Object, POBJECT_TYPE ObjectType, PHANDLE Handle)
|
||||||
if(cido != NULL)
|
if(cido != NULL)
|
||||||
{
|
{
|
||||||
cido->ref = 1;
|
cido->ref = 1;
|
||||||
cido->Lock = 0;
|
ExInitializeFastMutex(&cido->Lock);
|
||||||
cido->Obj.Object = Object;
|
cido->Obj.Object = Object;
|
||||||
|
|
||||||
KeAcquireSpinLock(&CidLock, &oldIrql);
|
KeAcquireSpinLock(&CidLock, &oldIrql);
|
||||||
|
@ -147,35 +147,16 @@ PsLockCidHandle(HANDLE CidHandle, POBJECT_TYPE ObjectType)
|
||||||
|
|
||||||
if(Found != NULL)
|
if(Found != NULL)
|
||||||
{
|
{
|
||||||
ULONG Attempt = 0;
|
ExAcquireFastMutex(&Found->Lock);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Found;
|
return Found;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
PsUnlockCidObject(PCID_OBJECT CidObject)
|
PsUnlockCidObject(PCID_OBJECT CidObject)
|
||||||
{
|
{
|
||||||
InterlockedExchange(&CidObject->Lock, 0);
|
ExReleaseFastMutex(&CidObject->Lock);
|
||||||
PspDereferenceCidObject(CidObject);
|
PspDereferenceCidObject(CidObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue