- Use the Spare0 array, present in EPROCESS instead of ReactOS-specific members for Process Locking (temporary fix until pushlocks are used).

svn path=/trunk/; revision=21933
This commit is contained in:
Alex Ionescu 2006-05-18 18:55:38 +00:00
parent bf6dcf5f85
commit 93a0bb6787
4 changed files with 26 additions and 8 deletions

View file

@ -200,9 +200,6 @@ typedef struct _ROS_EPROCESS
UCHAR PriorityClass;
MM_AVL_TABLE VadRoot;
ULONG Cookie;
KEVENT LockEvent;
ULONG LockCount;
struct _KTHREAD *LockOwner;
MADDRESS_SPACE AddressSpace;
} ROS_EPROCESS, *PROS_EPROCESS;
#include <poppack.h>

View file

@ -14,6 +14,11 @@
#define NDEBUG
#include <internal/debug.h>
#define LockEvent Spare0[0]
#define LockCount Spare0[1]
#define LockOwner Spare0[2]
/* GLOBALS *******************************************************************/
PETHREAD PspReaperList = NULL;
@ -159,6 +164,9 @@ PspDeleteProcess(PVOID ObjectBody)
ExDestroyHandle(PspCidTable, Process->UniqueProcessId);
}
/* Delete the process lock */
ExFreePool(((PROS_EPROCESS)Process)->LockEvent);
/* KDB hook */
KDB_DELETEPROCESS_HOOK(Process);

View file

@ -14,6 +14,10 @@
#define NDEBUG
#include <internal/debug.h>
#define LockEvent Spare0[0]
#define LockCount Spare0[1]
#define LockOwner Spare0[2]
/* GLOBALS ******************************************************************/
PEPROCESS PsInitialSystemProcess = NULL;
@ -52,7 +56,7 @@ PsLockProcess(PROS_EPROCESS Process, BOOLEAN Timeout)
/* we got the lock or already locked it */
if(InterlockedIncrementUL(&Process->LockCount) == 1)
{
KeClearEvent(&Process->LockEvent);
KeClearEvent(Process->LockEvent);
}
return STATUS_SUCCESS;
@ -61,7 +65,7 @@ PsLockProcess(PROS_EPROCESS Process, BOOLEAN Timeout)
{
if(++Attempts > 2)
{
Status = KeWaitForSingleObject(&Process->LockEvent,
Status = KeWaitForSingleObject(Process->LockEvent,
Executive,
KernelMode,
FALSE,
@ -99,7 +103,7 @@ PsUnlockProcess(PROS_EPROCESS Process)
if(InterlockedDecrementUL(&Process->LockCount) == 0)
{
(void)InterlockedExchangePointer(&Process->LockOwner, NULL);
KeSetEvent(&Process->LockEvent, IO_NO_INCREMENT, FALSE);
KeSetEvent(Process->LockEvent, IO_NO_INCREMENT, FALSE);
}
KeLeaveCriticalRegion();
@ -325,7 +329,10 @@ PspCreateProcess(OUT PHANDLE ProcessHandle,
/* Setup the Lock Event */
DPRINT("Initialzing Process Lock\n");
KeInitializeEvent(&((PROS_EPROCESS)Process)->LockEvent, SynchronizationEvent, FALSE);
((PROS_EPROCESS)Process)->LockEvent = ExAllocatePoolWithTag(PagedPool,
sizeof(KEVENT),
TAG('P', 's', 'L', 'k'));
KeInitializeEvent(((PROS_EPROCESS)Process)->LockEvent, SynchronizationEvent, FALSE);
/* Setup the Thread List Head */
DPRINT("Initialzing Process ThreadListHead\n");

View file

@ -14,6 +14,10 @@
#define NDEBUG
#include <internal/debug.h>
#define LockEvent Spare0[0]
#define LockCount Spare0[1]
#define LockOwner Spare0[2]
extern LARGE_INTEGER ShortPsLockDelay, PsLockTimeout;
extern LIST_ENTRY PriorityListHead[MAXIMUM_PRIORITY];
@ -253,7 +257,9 @@ PsInitProcessManagment(VOID)
MmInitializeAddressSpace((PROS_EPROCESS)PsInitialSystemProcess,
&((PROS_EPROCESS)PsInitialSystemProcess)->AddressSpace);
KeInitializeEvent(&((PROS_EPROCESS)PsInitialSystemProcess)->LockEvent, SynchronizationEvent, FALSE);
((PROS_EPROCESS)PsInitialSystemProcess)->LockEvent =
ExAllocatePoolWithTag(PagedPool, sizeof(KEVENT), TAG('P', 's', 'L', 'k'));
KeInitializeEvent(((PROS_EPROCESS)PsInitialSystemProcess)->LockEvent, SynchronizationEvent, FALSE);
#if defined(__GNUC__)
KProcess->DirectoryTableBase =